Mihail Radu Solcan

  Typeset Ancient Greek with Vim

2007-08-24

See also recent enhancements (2008-12-29)

The problem which inspired these lines is quite simple: it is the problem of writing a few words in Ancient Greek. This happens frequently when one writes a philosophical paper. For example, one of my students wrote a contribution to the Romanian Wikipedia and had to include a few words in Ancient Greek.

The solution suggested here is to use an editor which is capable to work with Unicode. I prefer Vim.

The solution described here is for GNU/Linux. I tested it on Fedora4. Vim is included in GNU/Linux distributions, but it is not available from the beginning on Windows. However, it is easy to install Vim on Windows. You need a version of Windows which works with Unicode.

In the Wikipedia article about the Greek Alphabet there is a section on Greek in Unicode. The tables of that section describe the codes of the Greek letters.

There are several methods for writing Greek in Unicode with Vim. The first, but not the easy one, is to use Vim's method for inserting Unicode. For this put Vim in insert mode. Just pressing the "Insert" key would do it, but people who are a bit familiar with Vim know other ways too. Then press Ctrl+V and you will see the cursor before a small inverted "v". Then press the "u" key. After this input the Unicode code. Well, this is not the nicest method to type Unicode ! Fortunately, there are many other solutions.

The second - most obvious method - is to use the Vim keymap for Greek.

I will advocate here, however, a third method. Why? First, the keymap forced me to learn another way of typing Ancient Greek. Second, the details of the Greek diacritics are not always easy to catch on the display of the computer. Third, I already knew how to use Betacode.

Reading and writing Ancient Greek on a computer display are not the same thing. Unicode is very good for reading. After all, it is used for printing books too. But Betacode is an excellent solution for writing Ancient Greek on a computer.

Even if you do not know German, you can easily understand the examples in the schematic description of (non-standard) Betacode in the german Wikipedia.

The Perseus Digital Library is able to display Greek text both in Unicode and Betacode.

Text in Betacode
Two short quotations from Plato's Theaitetos

How do we use the text in Betacode? For example, how could one display the above text in a web page?

A very simple solution is to use the SPIonic font. See the Ancient Greek with Thrasymachus for both the link to the SPIonic font and an example of the use of that font. SPIonic encoding is similar to Betacode, but it would be difficult to adapt each time manually the Betacode text. Thus I wrote a Vim script which handles the task.

Vim scripts from this site. Extract the three scripts from the archive in the folder where you keep the file with the text in Betacode. Please note that these are scripts for writing short quotations in Ancient Greek - not for converting long texts! Use only Betacode and always make first a back-up of your file with Betacode text. The scripts are experimental.

In the above image with the fragments from Plato, the third button from right is the "Run a Vim Script" button. Press the button and look for the beta2spionic.vim script. Press the "OK" button. The result, for the fragments from Plato, is as follows:

Text in SPIonic

Install the SPIonic font on your computer ! Write an html page. Put the first fragment in html tags like this: <font face="SPIonic"></font> and the result is:

Text in SPIonic rendered in the browser

Unicode is a better solution than SPIonic. There are many Unicode fonts and the result in Vim is straightforward. This time use the beta2unicode.vim script. When Vim says "more" press "Space". At the end of the messages press "Enter".

Text in Unicode

One can copy and paste the Unicode text where it is needed. There is however one problem left. In web pages the result is sometimes uncertain. Run the unicodeGreek2xml.vim on the Greek Unicode text (not the Betacode !!!). The result in Vim is unreadable, but it is readable in a web page like this one:

ἔφη δὲ τὴν μὲν μετὰ λόγου ἀληθῆ δόξαν ἐπιστήμην εἶναι, τὴν δὲ ἄλογον ἐκτὸς ἐπιστήμης

Πλάτων - Θεαίτητος

A few remarks on the Betacode accepted by the scrips: (1) you may use either upper case or lower case letters, but (2) always put an astrisk in front of capital Greek letters; (3) the order of the diacritics is the standard Betacode order, but (4) you may insert the signs for diacritics after the Greek capital letters. A few tests or a look at the substitutions in the Vim scripts should make these observations obvious.

I have added in the new version of the converters a script for converting from Unicode to Betacode. If you want to get standard Betacode, uncomment the line ":normal ggVGU (remove the inverted commas). I find however easier to read Betacode with upper case and lower case than standard Betacode, which has only upper case letters.

You may find convenient the addition of an icon for the Betacode to Unicode script on the Vim toolbar. See in this note how you can add the icon.

The GNU General Public License gives you the rights to copy and modify the scripts. It should be especially easy to correct mistakes in the substitutions or extend them to further cases.



Older versions

Version 0