by Vern S. Poythress
May, 2019
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. I wrote up my notes in 2007, and updated them in Jan., 2011. But I find that things have changed since then. So I am writing a new set of instructions below to apply to more recent linux systems.
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. In 2011 Steven Coxhead wrote instructions for GNU/linux that involve using IBus. But I am used to another way, which I document here.
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.
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 Hebrew as 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. I recommend Galatia, published by SIL. 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 or another manager that will unzip the files. 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 the desktop (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 LibreOffice or another word processor 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. In LibreOffice 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” (LibreOffice). Other word processors will provide similar ways for you to insert special characters.
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.
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 (some systems may have /etc/bash.bashrc instead) 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.
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.txt and il.228.txt. These files tell your computer how various keys of your keyboard correspond to Greek characters (gr.new or gr.228.txt) and Hebrew characters (il.new or il.228.txt). If you do not like the way I set up the keymaps, you can edit these files with a text editor. Some people like the c key to correspond to Greek xi, and the x key to Greek chi. You may use gr.228cx.txt (change the name to gr.228.txt after downloading).
Step 3. Find the place to install the keymaps. The question is where. Probably /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.228.txt /usr/share/X11/xkb/symbols/gr cp -v il.228.txt /usr/share/X11/xkb/symbols/il
Step 6. Alter your desktop manager so that it knows about multiple keymaps. Unity, Gnome, Kde, and Xfce all have utilities for “keyboard layouts.” The form for these differs over time, so the best solution here is to search on the internet for up-to-date instructions for your particular distribution and your particular desktop (Unity or Gnome or Kde or Xfce or other). Here are some instructions from Oct., 2013, for Unity, Gnome 3, and Kde. There are sequels for Xfce, Cinnamon, and Mate desktops, and for Lxde, Enlightenment, and Openbox.
Install gr (Greek) and il (Hebrew) in addition to your starting language (us). The keyboard layout utilities should offer you a choice of several kinds of keyboard layouts for Greek. Choose “polytonic.” Likewise, for Hebrew, choose “phonetic.”
Step 7. If necessary, log out and log back in, so that the desktop knows about these alterations. In Ubuntu, you may have to use the command
sudo dpkg-reconfigure xkb-data
to refresh the keymap data.
Explanation
The alterations you just made tell the desktop 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 utility for Xfce, you switch between layouts by clicking on the icon symbolizing the current layout. In Cinnamon you use a “hot key” to switch, a hot key specified in the keyboard layout utility offered within Cinnamon. Most other desktops will have either an applet for keyboard layouts or a way of assigning a hot key, within the system for keyboard layouts.
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, your system will no longer find it, and will consequently no longer be able to use 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 later, 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 LibreOffice already appropriates the right alt key for other uses. In Unity, Gnome, Kde, and Xfce, the keyboard layout function may or may not give you options as to what key you want to use for accessing the third level. (Try the next section below if you can’t get it on your system.) I use the right “windows” key for the third level. 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. The section entitled “Mark ordering” gives the information.
Getting the third level items
Some desktops offer no easy way to specify the third level. On my latest desktops, Debian 7.4.0 Wheezy and Linux Mint Debian (LMDE) running xfce4 as desktop, there is no way under the Keyboard Layouts. Also in Ubuntu 14.04, Unity and Gnome do not appear to me to offer a way. I can get everything else. To get the third level, I have to use a script that invokes the program setxkbmap. This way will work with xfce4 desktop, but not with Unity or Gnome. If you have a system with Unity or Gnome as your default, you can still install xfce4 as an extra desktop. You select your desktop when you login.
If you want to go this way, use the following steps.
Step 1: Obtain the script by right-clicking on this link and downloading the file “setkey” to a convenient location.
Step 2: Go to wherever you put the download, and set the file so that it can be executed as a script:
chmod +x setkey
You only need to do this once.
Step 3: Whenever you need the third level, open a terminal, cd to the appropriate folder where the script is located, and execute the script:
./setkey
Your usual file managers may also allow you to execute the script by left-clicking on it and then choosing the option, “run in a terminal.”
If you like, you can edit the script, using information found in
man setxkbmap
and in the file
/usr/share/X11/xkb/rules/xorg.lst
or
/usr/share/X11/xkb/rules/base.lst
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 LibreOffice 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. Your keyboard layout function should allow you to specify which key will be used as the “compose” key (I use left Windows (lwin)).
Now, open LibreOffice Writer. 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. You can see many other combinations on the appropriate Internet page. The expression “Multi-key” is the same as “compose.”
Alterations for Compose in Polytonic Greek
If you would like to change details in the way the “compose” process takes place in polytonic Greek, you should edit the file
/usr/share/X11/locale/en_US.UTF-8/Compose.
(If your locale is something other than “en_US.UTF-8,” substitute your own locale in the path.)
As usual, copy the original, unchanged Compose file to a safe place. Then copy the original file to a new name, and edit it with a text editor. Within the file, there are lots of lines of rules. You will want to edit a line or several lines in the section for compositions in Greek. It is pretty straight-forward. You will have to know the unicode for each of the characters that you want to appear as output in your word processor. Bear in mind that the polytonic Greek keyboard map uses “dead” keys (dead_acute, dead_grave, dead_tilde, etc.) to correspond to when you want to enter a diacritic. When you have finished to your satisfaction, copy the new file over the old:
sudo cp -v Compose.new /usr/share/X11/locale/en_US.UTF-8/Compose.
You have to have administrative privileges (“sudo”) to do this.
Vern S. Poythress, Ph.D., Th.D. Westminster Theological Seminary Philadelphia, Pennsylvania
Copyright (c) 2014 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.