Writing Greek with vim and latex

The process of making printable Greek files with vim has improved a lot with recent versions of vim. You can type both modern Greek and Greek with the full complement of accents (polutoniko). This describes the steps I use in Linux (Arch in my case, but should work in other flavours of Linux). It also works in OpenBSD.

Steps

  1. Make sure all the texlive stuff is installed, including texlive-lang-greek. This should give you both greek and polutonikogreek (i.e. accents, breathings etc.).

  2. This is the template I use:
    \documentclass{article}
    \usepackage[polutonikogreek]{babel}
    \usepackage[iso-8859-7]{inputenc}
    \begin{document}
    \selectlanguage{polutonikogreek}

    % accents go before the letter
    % eta=h, theta=u, xi=j, chi=x, upsilon=y, psi=c, omega=w, final s=v

    \Large

    [TEXT HERE]

    \end{document}

  3. Type the following commands:
    :set enc=greek
    :set fenc=greek
    :set keymap=greek

  4. To produce your Greek file, do the following:
    1. Type your text: note that accents come BEFORE the vowel they relate to. Use > and < for breathings (if you want them).
    2. Run latex on the file you have made and check with xdvi to make sure that it has come out correctly.
Notes:
  1. Make sure that your version of vim has keymap enabled (vim --version). If it doesn't, you can still produce Greek text with latex but you won't be able to see Greek characters on the screen as you type.

  2. If you don't like the way the Greek keymap works you can edit it (located at /usr/share/vim/vim74/keymap/greek.vim in my case). The current key map seems rather non-intuitive; I've listed the strange ones in the above template.

  3. If you want to insert Latex codes such as \vspace or \pagebreak, don't do this in Greek or they won't work. The easiest way of putting them in is to save the file and reload it but don't set the keymap to Greek. Just save the modified file and run latex on it.

Web Analytics Made Easy -
StatCounter
BACK