CGREEK23 FOR DEBIAN AND UBUNTU

This document describes how to install and use CGreek23 on a Debian-based system. The test has been done on Debian Squeeze and Ubuntu 9.10.

Table of contents

  1. Installation
  2. Basic Operations
  3. Using TLG CD-ROM
  4. Printing with TeX
  5. Customisation

Installation

Install the core system

  1. Add extra packages

    First of all, install Debian Squeeze or Ubuntu 9.10 on your computer and make sure that your system is up-to-date. Then open a terminal with Applications → Accessories → Terminal and issue the following command in the terminal.

      $ sudo aptitude install emacs23-gtk texlive-latex-base texlive-lang-greek flex libc6-dev emacs-intl-fonts
    

    The computer will install additional packages to resolve dependency. Hit Return to the question "Do you want to continue [Y/n]?".

  2. Extract files

    Download the tarball and untar it under your home directory.

      $ cd
      $ tar xfvz Desktop/cgreek23.tar.gz
    

    The above operations create the directory ~/cgreek23 and save all the necessary files there.

  3. Rewrite ~/.emacs

    Add the following lines at the end of your ~/.emacs file.

      (setq load-path (cons "~/cgreek23" load-path))
      (load "cgreek")
    

Install the TLG reader

If you have a TLG CD-ROM and want to use it, read this section and follow the instructions below. If not, go to the section Test.

  1. Compile the programs

    To read a TLG CD-ROM, you have to compile two programs that are included in this package, i.e. tlg2emacs and tlg2cit. Issue the following commands in a terminal window.

      $ cd ~/cgreek23
      $ make
    
  2. Set the TLG directory

    The TLG reader assumes that the TLG CD-ROM is mounted on the directory /media/cdrom. In other words, files must be accessible with the pathnames like /media/cdrom/authtab.dir, /media/cdrom/tlg0059.txt, etc. If this is not the case on your system, remove the leading semicolon of the following line in the ~/cgreek23/cgreek.el file and replace the string "/media/cdrom" with an appropriate one for your system.

      ;(setq cgreek-tlg-directory "/media/cdrom")
    
  3. Set the TLG version

    If you are using TLG CD-ROM version D, remove the leading semicolon of the following line in the ~/cgreek23/cgreek.el and change the string "E" to "D".

      ;(setq cgreek-tlg-cdrom-version "E")
    

    The default value of this variable is "E".

Test

  1. Start Emacs with Applications → Accesories → GNU Emacs 23.
  2. Select CGreek → Open TeX File from the Emacs' menu bar and select sample.tex in the cgreek23 directory.

Do you see an example of multilingual text?

Back to table of contents

Basic operations

We do not explain the basic operations of Emacs itself. If you are new to Emacs, try its online tutorial (invoked by C-h t).

Keyboard input

  1. Greek Characters

    First, select CGreek → Input Greek from the menu. Then input Greek characters as described below.

    keyGreek
    aalpha
    bbeta
    ggamma
    ddelta
    eepsilon
    fphi
    zzeta
    heta
    qtheta
    iiota
    kkappa
    llambda
    mmu
    nnu
    xxi
    oomicron
    ppi
    rrho
    ssigma
    ttau
    uupsilon
    ypsi
    cchi
    womega

    Lowercase j gives terminal sigma and uppercase J gives iota subscriptum.

      a j  →  <alpha> <terminal sigma> (2 characters)
      a J  →  <alpha + iota sub.> (1 character)
    

    Consult the table below for various marks.

    keymark
    'smooth breathing
    vsmooth breathing
    `rough breathing
    Vrough breathing
    /acute accent
    ?grave accent
    \circumflex accent
    ^circumflex accent
    "trema
    keypunctuation
    ,Greek comma
    .Greek full-stop
    ;Greek question mark
    :Greek colon
    keyarchaic character
    !lower sampi
    #lower digamma
    $lower stigma
    %lower koppa
    &upper koppa

    You have to type iota subscriptum (the J key) right after the vowel, but other accents, breathings and trema can be typed in any order.

      a J ' ?   →  <alpha + iota sub. + smooth + grave>
      w / `   →  <omega + acute + rough>
    

    A key stroke preceded by C-q gives an independent character.

      a  '  →  <alpha + smooth>  (1 character)
      a C-q '  →  <alpha> <'>  (2 characters)
    

    We also provide an Ibycus4-like input method for Greek. If you have already learned Ibycus4, you may prefer this method. See Using other input methods for the details.

  2. Latin characters with diacritical marks

    You can use any Latin input method supported by Emacs. The default is set to latin-1-postfix. To use this input method, select CGreek → Input Latin from the menu. Then type the following keys after a Latin character.

    keymarkexample
    'acutea ' → á
    `gravea ` → à
    ^circumflexa ^ → â
    "diaeresisa " → ä
    ~tildea ~ → ã
    ,cedillac , → ç
    /miscs / → ß

    A key stroke preceded by C-q gives an independent character.

      a '  →  <á>  (1 character)
      a C-q '  →  <a> <'>  (2 characters)
    

    Alternatively, you can decompose the attached diacritical mark and the base character by hitting the same key twice. (This is not the case for Greek.)

      a '  →  <á>  (1 character)
      a ' '  →  <a> <'>  (2 characters)
    

    For more information, consult the online help. To see it, type M-x quail-help when "Latin Mode" is selected from the CGreek menu. If you want to use other Latin input methods, see the section Using other input methods.

    To return to the ordinary ASCII mode, hit C-\.

  3. Other languages

    The CGreek menu has two more entries for keyboard input: Input Local Language and Input Foreign Language. For historical reasons, they default to the input methods japanese and russian-jcuken, respectively. You can, however, change the bindings to any language and any input method you like. See the section Using other input methods for details.

  4. Tips

    You may feel selecting the input language from the menu bar using the mouse is awkward. A quick alternative is to use function keys. The following explains how to do that.

    1. Open the file ~/cgreek23/cgreek.el.
    2. Look for the following lines in that file.
        ;(define-key global-map [f9]
        ;  (lambda () (interactive) (set-input-method cgreek-greek-im)))
        ;(define-key global-map [f10]
        ;  (lambda () (interactive) (set-input-method cgreek-latin-im)))
        ;(define-key global-map [f11]
        ;  (lambda () (interactive) (set-input-method cgreek-local-im)))
        ;(define-key global-map [f12]
        ;  (lambda () (interactive) (set-input-method cgreek-foreign-im)))
      
    3. Remove the semicolons at the beginning of lines to uncomment above lines.
    4. Save the buffer and restart Emacs.

    With this setting, F9, F10, F11 and F12 will change the input language to Greek, Latin and two other languages.

Printing

CGreek23 can print Greek characters as well as other characters. Follow the instruction below to get a hardcopy of an Emacs buffer.

  1. Printing the entire buffer

    Selecting the menu CGreek → Print Buffer converts the entire buffer into PostScript and sends it to the default printer.

  2. Printing a specific region

    Selecting the menu CGreek → Print Region works similar to the above, but prints only the specified region. This function is not available if region is not specified in the current buffer.

These printing functions use the bitmap fonts to print characters other than Latin-1. Therefore the quality of Greek and other characters is worse than that of Latin-1 characters, for which builtin PostScript fonts are used.

The printing quality is improved if you install a larger BDF font, say 36x72 pixels. To use a font other than the default one, see the section Customising ps-print.

Another way to get high quality output is to use TeX. This CGreek package understands how Greek characters are represented in Ibycus4, which is a Greek TeX. See the section Printing with TeX for details.

File I/O

CGreek23 supports five file formats for reading and three for saving. You can activate the functions from the menu bar.

Open a file

  1. CGreek → Open TeX File

    Read a file in which Greek characters are encoded in the form of the Ibycus4 LaTeX commands and accented Latin characters in the form of the standard LaTeX command.

  2. CGreek → Open Unicode File

    Read a file saved in the UTF-8 format. Only those Unicode characters that are supported by Emacs can be read.

  3. CGreek → Open HTML File

    First read a file in. Then convert all the &xxxx; sequences into the corresponding Unicode characters.

  4. CGreek → Open WinGreek File

    Read a file assuming that characters are encoded in the WinGreek format.

  5. CGreek → Open TLG CD-ROM

    Read a file recorded on a TLG CD-ROM. To use this function, you must install reader programs. See the section Install the TLG reader for the installation procedure. See the section Using TLG CD-ROM to read the recorded texts on the CD-ROM.

Save a buffer

  1. CGreek → Save TeX File

    Save the current buffer converting Greek characters into Ibycus4 LaTeX commands and accented Latin characters into standard LaTeX commands. The resulted file is a plain text.

  2. CGreek → Save Unicode File

    Save multilingual text in the UTF-8 format.

  3. CGreek → Save HTML File

    Unicode characters in the range of U+00A0..U+24FF, which include all Greek and accented Latin characers, are converted into the form of &xxxx; as in HTML. ASCII characters are left unchanged. Other characters are saved using the default encoding.

Back to table of contents

Using TLG CD-ROM

The TLG CD-ROM adopts a Latin transliteration to encode Greek (and other) characters. This transliteration schime is called beta code. This CGreek package includes a converter program, called tlg2emacs, that converts beta code into Emacs' internal representation.

When instructed to open a TLG file, Emacs internally invokes tlg2emacs and displays the converted text in a window. It also invokes another program tlg2cit to extract citation information intermingled with beta code.

Reading TLG files

You can read TLG files by selecting the menu CGreek → Open TLG CD-ROM.

following the menu path: CGreek, Open TLG CD-ROM

It opens the list of authors in the *TLG authtab* buffer.

list of authors and their TLG  numbers

You can create your own version of author list. See Customising author list for the details.

Hit the Enter key or click mouse-2 on an author. The list of works written by that author appears in the *tlg????.idt* buffer, where ???? is a 4-digit number representing the author. Let's call this buffer a "work list buffer". You can have more than one work list buffers.

list of Plato's works

Again, hit the Enter key or click mouse-2 on a title. The text of the work appears in another buffer with its name. Let's call this buffer a "work buffer". You can have multiple work buffers. You also see another small buffer *TLG citation* in which the citation information of the cursor position is displayed.

The upper window shows a part of Respublica.  The lower
     shows the author name, the work title, the page number,
     the section number and the line number you are looking at.

Hitting the a key (stands for author) in a work list buffer or in a work buffer brings you back to the author list *TLG authtab*.

Hitting the w key (stands for works) in a work buffer brings you back to the work list *tlg????.idt* of the same author.

Hitting the q key (stands for quit) in the *TLG authtab* buffer, in a work list buffer or in a work buffer kills that buffer.

Index jump

Hitting the j key (stands for jump) in a work buffer takes you to the specified position within a work. Emacs asks you the destination from the highest unit (e.g., Stephanus page) via middle units (e.g., section) to the lowest unit (e.g., line). Each time you enter a number, Emacs takes you to the beginning of the text specified so far. Once you are satisfied, you can quit specifying the position with C-g.

jumping to Stephanus page 327 to 433
Back to table of contents

Printing with TeX

The CGreek23 package supports TeX file I/O in the Ibycus4 style.

Save buffer in TeX format

Selecting CGreek → Save TeX File from the menu bar saves the current buffer to a file converting Greek characters into Ibycus4 commands. Each segment of consecutive Greek characters is surrounded by \begin{greek} and \end{greek}.

Accented Latin characters are converted into standard LaTeX commands that represent those characters.

Characters in other character sets, e.g., Japanese characters, are left unchanged.

The window, however, keeps on displaying Greek and accented Latin characters as they were.

When you create a TeX source file in which Greek and accented Latin characters are included, it is highly recommended to use this auto-conversion functionality rather than to handwrite TeX commands for those characters. There are multiple ways in TeX to represent a polytonic Greek character and some of them may not be decoded correctly by the automated decoding. The CGreek → Save TeX File operation, on the other hand, always uses the "canonical" command forms and they are guaranteed to be decoded correctly.

Note that saving in the TeX format only transliterates Greek and accented Latin characters. You must add \documentclass{article}, \begin{document}, \end{document} and other commands to process it with TeX.

Open file in TeX format

Files saved in the TeX format can be read in Emacs and edited afterwards. Select CGreek → Open TeX File from the menu bar. The TeX commands representing Greek and accented Latin characters are decoded automatically and appear as "actual" characters on the screen.

As warned above, this decoding process is not perfect. It can decode only "canonical" TeX commands for Greek and accented Latin characters. TeX commands you have handwritten may not be decoded correctly.

Converting TeX commands manually

Sometimes you get, intentionally or unintentionally, a buffer that shows raw TeX commands \begin{greek} ... \end{greek}. Visiting a TeX source file with C-x C-f is an example. You can manually convert the whole buffer or the specified region with the following commands

  M-x cgreek-tex-to-unicode-buffer
  M-x cgreek-tex-to-unicode-region

These commands first look for the string \begin{greek}, then convert the following TeX commands into Greek characters until they encounter the string \end{greek}. The strings \begin{greek} and \end{greek} themselves are deleted. They also convert the commands for accented Latin characters outside the \begin{greek} and \end{greek} into actual characters.

Reverse conversion is also possible.

  M-x cgreek-unicode-to-tex-buffer
  M-x cgreek-unicode-to-tex-region
Back to table of contents

Customisation

Using other input methods

Each time you select a language mode from the menu bar, the following variables are checked to decide the input method to be invoked.

language variable defalut value alternatives
Greek cgreek-greek-im greek-mizuochi greek-ibycus4
greek-babel-elot1000
Latin cgreek-latin-im latin-1-postfix latin-1-prefix
TeX
Local cgreek-local-im japanese
Foreign cgreek-foreign-im cyrillic-jcuken cyrillic-jcuken-unicode

The "alternatives" above are merely suggestions. You can specify any input method you like.

The value of these variables can be changed in the ~/cgreek23/cgreek.el file. Uncomment the setq lines and rewrite the name of input method if you want.

The mapping table of greek-ibycus4 is given below.

keyGreek
aalpha
bbeta
ggamma
ddelta
eepsilon
zzeta
heta
qtheta
iiota
kkappa
llambda
mmu
nnu
cxi
oomicron
ppi
rrho
ssigma
ttau
uupsilon
fphi
xchi
ypsi
womega

A lowercase sigma followed by a space, comma, period, etc. will automatically change its shape into a terminal sigma. If you want to be explicit, j always inserts a terminal sigma and s| always an ordinary sigma.

keymark
)smooth breathing
(rough breathing
'acute accent
`grave accent
=circumflex accent
+trema
|iota subscriptum
_below dot
keypunctuation
,Greek comma
.Greek full-stop
?Greek question mark
;Greek colon
((parenleft
))parenright
keyarchaic character
c+lower lunate sigma
C+upper lunate sigma
vlower digamma
Vupper digamma
k+lower koppa
K+upper koppa
s+lower sampi

When a character carries more than one marks, type them in the following order.

  1. base character
  2. breething or trema
  3. accent
  4. iota subscriptum
  5. below dot

A key stroke preceded by C-q makes an independent character.

  a '      →  <alpha + acute>  (1 character)
  a C-q '  →  <alpha> <'>  (2 characters)

Customising author list

Not many people require the complete list of classical authors. You can create your own version of author list for author selection.

First, open the *TLG authtab* buffer from the menu and save the contents in a file with C-x C-w. Then delete unnecessary lines or move your favourite authors to the top of the list.

Next, include the following line in your ~/.emacs file.

  (setq cgreek-tlg-my-authtab-file "/your/author/list/file/name")

You can always access the original authortab file even if you have a customised one. Issue the following command in Emacs.

  M-x set-variable RET cgreek-tlg-my-authtab-file RET nil RET

Customising ps-print

You can customise the behaviour of ps-print by setting variables. Here we explain some of them. If you want to know more, consult the info pages.

Customising TLG converter

The variable cgreek-tlg2emacs-program specifies the program that perform TLG conversion. Its default value is the string "~/cgreek23/tlg2emacs", thus pointing the default converter program tlg2emacs.

The source program is ~/cgreek23/tlg2emacs.lex, written in lex. You can modify this source to make your own converter program.

Suppose that you have installed your own converter program as /usr/local/bin/my_tlg_converter. In this case, put the following line in your ~/.emacs file to use that program instead of the default tlg2emacs.

  (setq cgreek-tlg2emacs-program "/usr/local/bin/my_tlg_converter")
Back to table of contents

Last modified : 31 March 2010