Keyboard Entry of Polytonic Greek and Biblical Hebrew in GNU/Linux

by Vern S. Poythress

January, 2011

 

I am a biblical scholar who writes in English, but who also needs to be able to type Greek and Hebrew into a word processor. I am offering these informal notes concerning my own experience developing keyboard entry for Greek and Hebrew in GNU/linux.

Modern Greek and modern (unpointed) Hebrew can already be entered from the keyboard because of the internationalization of GNU/linux. But it is more challenging to deal with unicode polytonic (classical) Greek or biblical Hebrew (with vowel points and accents). The Summer Institute of Linguistics has provided a keyboard driver that enables scholars to type unicode Hebrew in Windows 2000 and Windows XP. But I have not been able to find in one place all the necessary information with respect to GNU/linux. So I am providing here what I have learned.

 

Getting Unicode Greek and Hebrew fonts

Some older specialized Greek and Hebrew fonts differ from one another in their encoding. Texts using these fonts cannot be searched in a uniform way, because each font has its own idiosyncratic coding. The answer to this is unicode, which provides an international standard for encoding all languages.

In the long run, you should definitely use unicode-encoded Greek and Hebrew. But the transition to unicode has taken awhile, and is only now coming to fruition.

First, you need unicode-based Greek and Hebrew fonts. There are several. SBL Hebrew, available through the SBL website, will probably become the standard for biblical Hebrew. But there are restrictions on its commercial use. I recommend Ezra SIL Hebrewas a font without such restrictions. The Gentium font is also good, and includes glyphs for many languages. For Greek, New Athena Unicode or Gentium or FreeSerif will do. The Greek Font Society offers others. SBL has now come out with one.

 

Installing your Greek and Hebrew fonts

Now you must install the fonts that you have downloaded. Some are contained in zip files, and for these you must first extract the included .ttf files. From the command line, go to the directory into which you downloaded the file, and type

unzip filename.zip

where “filename.zip” is the name of the file. Or extract the files using your file manager Nautilus or Konqueror. Now you need to install the font files (with .ttf suffix). Most up-to-date GNU/linux distributions have a simple utility for doing font installation. Use that if you want. Or look for the directory ~/.fonts (i.e., /home/username/.fonts, where “username” is your username). If this directory does not exist, create it (mkdir /home/username/.fonts). Then copy the .ttf files to ~/.fonts. Then restart Xwindows (by logging out and then back in) so that these new fonts will be recognized.

 

Finding your characters in the unicode charts

To have more information about the unicode coding for the characters, you will probably also want to have the unicode code charts for Greek and Hebrew. On the internet, go to the Unicode home page (www.unicode.org), and then to the Unicode Character Code Charts. Click on Greek (under the European Alphabets), and print out the pdf file that is displayed. Do the same for Greek Extended (under the European section), Hebrew, and Hebrew Presentation Forms (under Middle Eastern Scripts).

 

Entering characters one by one

Once your fonts are installed, you can start OpenOffice or KWord and it will have your fonts on its list of fonts to choose. But if you just choose the font and start typing, the text will still come out as Latin characters. You can insert a single unicode character by clicking on the “Insert” menu, and under that “Special Character …” Pick the font that you want (it must be a unicode font that includes Greek or Hebrew glyphs), and then search for the particular character in the unicode tables that are displayed for that font. Click on the character, and then “OK” (OpenOffice) or “Insert” (KWord). (The last I checked, Abiword can’t yet do this. It will come.)

But of course if you have many characters to insert, this route becomes tedious. That is why you may want to have “keyboard maps” that allow you to type in whole words and sentences at once.

 

Adding keymaps

Dealing with keymaps was the most challenging part for me. A recent (2011) discussion is now available from Steven Coxhead at <http://berithroad.blogspot.com/2011/01/sbl-hebrew-keyboard-for-linux.html> . Below is my more dated discussion.

Step 1. Fix the locale. Open a command line (terminal emulator), and type “locale”. Then press the <Enter> key. If your main language is English, you should get as the first line of the output:

LANG=en_US.UTF-8

If this is what you get, all is well.  You can go to Step 2.  If not, you can change the locale by entering the following command:

export LANG=en_US.UTF-8

This tells your system that you are unicode-capable (the “UTF-8″ part) and that your base language is US English (the “en_US” part). To make this change carry over after you reboot, you need to get root privileges and then add a line to /etc/bashrc or /etc/profile:

export LANG=en_US.UTF-8

Also eliminate any line in /etc/bashrc or /etc/profile that sets LANG to another value. You may also need to check /home/username/.bashrc to see whether it sets the LANG value for a particular user.  (If you just want to have this feature for one user, rather than for all users, you would change the file /home/username/.bashrc rather than /etc/profile.)

Step 2. Obtain keymaps. I made some special keymap files that you can download for the purpose: gr.new and il.new. These maps no longer work in Ubuntu 9.10. I think that is because of an upgrade to Gnome 2.28. For newer distributions (I would guess from Oct., 2009, onward) you will need gr.228 and il.228 (you will have to unzip the files after downloading them). These files tell your computer how various keys of your keyboard correspond to Greek characters (gr.new or gr.228) and Hebrew characters (il.new or il.228).  If you do not like the way I set up the keymaps, you can edit these files with a text editor.

Step 3. Find the place to install the keymaps. The question is where. In Ubuntu 9.04, navigate to /usr/share/X11/xkb/symbols (This subdirectory should exist. If it does not exist in your linux distribution, try a file search to locate the subdirectory “xkb”.) The subdirectory xkb should have a subdirectory called “symbols,” in which will be text files like ad, af, al, am, gr, il, and others.  Each of these is for a particular language.

Step 4.  Back up your current keymaps for safety.  That way, if the changes do not work, you can always go back to the original setup that you had before.

Here is one way of doing a backup with a command line:

cd
mkdir keymapbk
cp -v /usr/share/X11/xkb/symbols/gr keymapbk/gr.orig
cp -v /usr/share/X11/xkb/symbols/il keymapbk/il.orig

Step 5. Install the keymaps. Navigate to the directory to which you downloaded the new keymaps (the ones that I supplied), obtain root privileges, and from the command line do:

cp -v gr.new /usr/share/X11/xkb/symbols/gr
cp -v il.new /usr/share/X11/xkb/symbols/il

or do the analogous commands with gr.228 and il.228.

Step 6. Alter your desktop manager so that it knows about multiple keymaps. Instructions for polytonic Greek are found at https://docs.google.com/View?docID=dccdrjqk_4cqjn9zcj, and further discussion at http://simos.info/blog/archives/888. I include instructions below that add a Hebrew layout as well.

For Gnome desktop, go to an empty spot on the panel and right-click on it.  Choose Add to Panel -> Keyboard Indicator.  Click on “Add.”  The icon should appear.  Click on “Close” to close out the “Add to Panel” window.  Then right click on the newly added icon for Keyboard Layout (if your base language is US English, the icon will have the letters “USA”).  Select “Keyboard Preferences.”  Select the tab labeled “Layouts.”  Then add the “Greece” and “Israel” layouts. If there is an option for “variants,” as there will be for newer versions of the Gnome Desktop, choose “Greece Polytonic” and “Israel Phonetic.” Also, click on “Layout Options.” You should indicate what key you want to use for the “third-level” in Hebrew (discussed below). (I use the right windows key.) And indicate what key you want to use for “Compose.” A similar process should work for the KDE desktop.

For the Xfce desktop, the simplest way is first to install an applet that allows you to add gnome applets to your xfce panel. In Ubuntu 9.04, the name of the package is xfce4-xfapplet-plugin. It is probably not installed on your system. Install it. Then right-click on your panel and choose “Add New Items.” Look for XfApplet. Click on it. Then click “Add.” Then look for “Keyboard layout indicator,” and click on it.

Once the applet appears on your panel, you can add Greek and Hebrew layouts, according to the instructions given above for the Gnome desktop.

Step 7. Restart Xwindows so that it knows about these alterations.

 

Explanation

The alterations you just made tell Xwindows that it is supposed to search for and use three distinct keymaps, “us” (normal latin alphabet), “gr” (Greek), and “il” (Hebrew). (Here I am once again assuming that your main language is English.  Users working mainly in other languages may want something else besides “us.”)  If you used the keyboard layout utilities in KDE or Gnome or Xfce, you switch between layouts by clicking on the icon symbolizing the current layout.

 

Other options

Keymaps

I have chosen the keymaps for Greek to suit my own convenience.  (My apologies to native Greek and Hebrew speakers, who expect something else.) Here is a list of equivalences:

Greek US Greek (caps) US
alpha α a cap alpha Α A
beta β b cap beta Β B
gamma γ g cap gamma Γ G
delta δ d cap delta Δ D
epsilon ε e cap epsilon Ε E
zeta ζ z cap zeta Ζ Z
eta η h cap eta Η H
theta θ q cap theta Θ Q
iota ι i cap iota Ι I
kappa κ k cap kappa Κ K
lambda λ l cap lambda Λ L
mu μ m cap mu Μ M
nu ν n cap nu Ν N
xi ξ x cap xi Ξ X
omicron ο o cap omicron Ο O
pi π p cap pi Π P
rho ρ r cap rho Ρ R
sigma σ s cap sigma Σ S
finalsigma ς v
tau τ t cap tau Τ T
upsilon υ u cap upsilon Υ U
phi φ f cap phi Φ F
chi χ c cap chi Χ C
psi ψ y cap psi Ψ Y
omega ω w cap omega Ω W
Greek question mark ; ;   or  ? Greek colon ? :
iota subscript j
acute accent ‘ (apostrophe) or / (slash) diaeresis
grave accent ` (grave) circumflex accent ~ (shifted tilde key)
rough breathing 9 or shift-9 ’(‘
smooth breathing 0 or shift-0 ‘)’
diaeresis ” (double quote)

Adriaan Pater has kindly provided keyboard pictures with each key labeled appropriately.  There is one picture for Greek and one for Hebrew.

If you like, you can edit the file “gr” in order to change some of the key assignments. However, if you rename the file when you edit it, Xwindows will no longer find it.

For Greek, when you are keying in accents and breathing, note the following. (1) Accents, including iota subscript, should be keyed in before the vowel to which they belong. (2) The accents will not appear on screen until the vowel to which they belong is keyed in. (3) In earlier versions of linux, when several accents belong to the same vowel, they should be keyed in more or less in a right-to-left order. Thus omega with rough breathing, acute, and iota subscript should be keyed in with iota subscript (j) first, then acute (apostrophe), then rough breathing (left parenthesis). If you don’t use this order, the full result may not come out. In Ubuntu 9.04 and 9.10 everything seems to work regardless of order, provided only that the vowel is keyed in following all the accents.

For Hebrew I have constructed a keymap that actualizes the keyboard described by John Hudson in his Tiro manual for Hebrew. You can edit the file “il” if you want to change some of the key assignments.

This Hebrew keymap has four “levels.” But not every key has an output on all four levels. The first level is normal. Just press the ‘m’ key to get m on the normal level. The second level is the “shifted” level.  Hold down the shift key and then press the ‘m’ key (or whatever key you need). The third, called “ALTGR” in John Hudson’s documentation, is supposed to be accessed by holding down the right alt key or right alt + ctrl. But OpenOffice already appropriates the right alt key for other uses. Within the keyboard layout function, “Layout Options,” you have options as to what key you want to use for accessing the third level. I use the right “windows” key. If you use this setting, hold down the right “windows” key, which in a typical keyboard is right next to the right alt key, and which has a Microsoft logo on it. While holding it down, press the key that you need. Thus the meteg accent can be added by holding down the right windows key and then pressing the 1 (numeral 1) key. The fourth level is accessed by simultaneously holding down the right windows key and the right shift key, and then pressing the key that you want.  On some systems, the shift key must be held down first, and then the right windows key.

 

Hebrew US key
alef א shifted-period
bet ב b
gimel ג g
dalet ד d
he ה h
vav ו w
zayin ז z
het ח x
tet ט v
yod י y
kaf כ k
finalkaf ך K
lamed ל l
mem מ m
finalmem ם M
nun נ n
finalnun ן N
samekh ס s
ayin ע shifted comma
pe פ p
finalpe ף P
tsadi צ c
finaltsadi ץ C
qof ק q
resh ר r
sin (no dot) ש S
sin (with dot) שׂ f
shin (with dot) שׁ j
tav ת t
patah  אַ a
hataf patah  אֲ rwin-shift A
qamats  אָ A (shift a)
hataf qamats  אֳ rwin-shift O
segol  אֶ e
hataf segol  אֱ rwin-shift E
tsere  אֵ E
hiriq  אִ i
holam  אֹ o
qubuts   אֻ u
sheva  אְ semicolon
dagesh אּ equal sign ‘=’
dehi א֭ rwin 6
etnahta א֑ rwin equal-sign
geresh א֜ shift 4
gershayim א֞ shift 5
iluy א֬ shift 7
mahapakh א֤ rwin backslash
maqaf ־ hyphen ‘-’
merkha א֥ rwin 4
merkha kefula א֦ rwin 5
meteg or silluq אֽ rwin 1
munah א֣ rwin 7
pashta א֙ rwin-shift 6
qadma א֨ shift 3
rafe אֿ rwin-shift hyphen
revia א֗ Q
sof pasuq ׃ rwin-shift semicolon
tevir א֛ rwin 8
tipeha א֖ rwin 3
yerah א֪ rwin 0
yetiv א֚ rwin right-bracket
zaqef qatan א֔ rwin-shift left-bracket
zaqef gadol א֕ rwin-shift 8
zarqa א֘ shift 2

For a list of keys for all the other accents according to il, see John Hudson’s Tiro manual for Hebrew.  Adriaan Pater has provided a picture of a keyboard for Hebrew.

For Hebrew, care should be taken to enter pointing and accents in the order specified in the SBL Hebrew manual. This manual comes along with the SBL Hebrew download. Once unzipped, it is named “SBLHebrew-Manual.pdf.” The section entitled “Mark ordering” gives the information.

 

Other special characters

I have found that on occasion I need to enter accented Roman characters, such as e with an acute accent or o with an umlaut. You can do this in OpenOffice or in KWord in the way that I have already described, by using the main Menu, selecting “Insert,” and then “Special Character.” Or you can introduce an international keyboard, or add a French or German language keyboard. But for my use, the simplest solution is to stay with the US keyboard, and use a “multi-key” key or “compose” key preceding the accent. Here is how to do it in Gnome.

Step 1. From your menu, select System/Preferences/Keyboard.

Step 2. Select the “Layouts” tab. Click on “Layout Options …” near the bottom right. Click on “Compose key position.” Check on “Left Win-key is Compose,” or whichever option that you want as your compose key. Click “Close” twice to exit.

Now, open OpenOffice Writer or KWord. To compose an e with an acute accent, press the compose key (in my case, the left Windows key), then single quote (‘), then “e.” To compose e with grave accent, press compose, then grave (`), then “e.” To compose o with umlaut, press compose, then double quote (shift single quote), then “o.” The cent sign is compose, slash, “c.” The sign for British pound is compose, minus, “L.” c with cedilla is compose, comma, “c.” The Euro symbol is compose, “=”, “c.” Similarly with other special characters. By opening the “Compose.new” file with a text editor, you can see many other combinations. The expression “Multi-key” is the same as “compose.”

 


Vern S. Poythress, Ph.D., Th.D.
Westminster Theological Seminary
Philadelphia, Pennsylvania


Copyright (c) 2007 by Vern Sheridan Poythress.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license can be found at the Free Software Foundation website.