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.
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]?".
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.
Add the following lines at the end of your ~/.emacs file.
(setq load-path (cons "~/cgreek23" load-path)) (load "cgreek")
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.
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
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")
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".
Do you see an example of multilingual text?
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).
First, select CGreek → Input Greek from the menu. Then input Greek characters as described below.
key | Greek |
---|---|
a | alpha |
b | beta |
g | gamma |
d | delta |
e | epsilon |
f | phi |
z | zeta |
h | eta |
q | theta |
i | iota |
k | kappa |
l | lambda |
m | mu |
n | nu |
x | xi |
o | omicron |
p | pi |
r | rho |
s | sigma |
t | tau |
u | upsilon |
y | psi |
c | chi |
w | omega |
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.
key | mark |
---|---|
' | smooth breathing |
v | smooth breathing |
` | rough breathing |
V | rough breathing |
/ | acute accent |
? | grave accent |
\ | circumflex accent |
^ | circumflex accent |
" | trema |
key | punctuation |
---|---|
, | Greek comma |
. | Greek full-stop |
; | Greek question mark |
: | Greek colon |
key | archaic 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.
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.
key | mark | example |
---|---|---|
' | acute | a ' → á |
` | grave | a ` → à |
^ | circumflex | a ^ → â |
" | diaeresis | a " → ä |
~ | tilde | a ~ → ã |
, | cedilla | c , → ç |
/ | misc | s / → ß |
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-\.
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.
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.
;(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)))
With this setting, F9, F10, F11 and F12 will change the input language to Greek, Latin and two other languages.
CGreek23 can print Greek characters as well as other characters. Follow the instruction below to get a hardcopy of an Emacs buffer.
Selecting the menu CGreek → Print Buffer converts the entire buffer into PostScript and sends it to the default printer.
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.
CGreek23 supports five file formats for reading and three for saving. You can activate the functions from the menu bar.
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.
Read a file saved in the UTF-8 format. Only those Unicode characters that are supported by Emacs can be read.
First read a file in. Then convert all the &xxxx; sequences into the corresponding Unicode characters.
Read a file assuming that characters are encoded in the WinGreek format.
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 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.
Save multilingual text in the UTF-8 format.
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.
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.
You can read TLG files by selecting the menu CGreek → Open TLG CD-ROM.
It opens the list of authors in the *TLG authtab* buffer.
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.
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.
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.
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.
The CGreek23 package supports TeX file I/O in the Ibycus4 style.
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.
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.
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
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.
key | Greek |
---|---|
a | alpha |
b | beta |
g | gamma |
d | delta |
e | epsilon |
z | zeta |
h | eta |
q | theta |
i | iota |
k | kappa |
l | lambda |
m | mu |
n | nu |
c | xi |
o | omicron |
p | pi |
r | rho |
s | sigma |
t | tau |
u | upsilon |
f | phi |
x | chi |
y | psi |
w | omega |
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.
key | mark |
---|---|
) | smooth breathing |
( | rough breathing |
' | acute accent |
` | grave accent |
= | circumflex accent |
+ | trema |
| | iota subscriptum |
_ | below dot |
key | punctuation |
---|---|
, | Greek comma |
. | Greek full-stop |
? | Greek question mark |
; | Greek colon |
(( | parenleft |
)) | parenright |
key | archaic character |
---|---|
c+ | lower lunate sigma |
C+ | upper lunate sigma |
v | lower digamma |
V | upper digamma |
k+ | lower koppa |
K+ | upper koppa |
s+ | lower sampi |
When a character carries more than one marks, type them in the following order.
A key stroke preceded by C-q makes an independent character.
a ' → <alpha + acute> (1 character) a C-q ' → <alpha> <'> (2 characters)
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
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.
Each ps-print page comes with a header by default. If you prefer simpler style, include the following line in your ~/.emacs file.
(setq ps-print-header nil)
The font size in ps-print is controlled by the variable ps-font-size. Put the following line in your ~/.emacs file to change the font size to 10 point.
(setq ps-font-size 10)
You need to prepare two bigger bdf fonts to get better quality in printing Greek characters. Fonts of the size 36x72 pixels should make you satisfied.
Several tools are available to create or modify bdf fonts. For example, bdfresize can be used to magnify or shrink bdf fonts. Another program called gbdfed has a good user interface for font design. In these days, a powerful font editor called fontforge is widely used. All of these are available as packages. Install them with the following command.
$ sudo apt-get install bdfresize gbdfed fontforge
Once you have created new bdf fonts, save them under the directory ~/cgreek23/bdf with an arbitrary name, say, new-iso8859-7.bdf and new-unicode.bdf.
Then rewrite the file ~/cgreek23/cgreek.el. Look for the following lines.
(normal bdf "cgreek24-iso8859-7.bdf" iso-8859-7)) ... (normal bdf "cgreek24-unicode.bdf"))
Replace the strings cgreek24-iso8859-7.bdf and cgreek24-unicode.bdf with new-iso8859-7.bdf and new-unicode.bdf so that the lines look like the following.
(normal bdf "new-iso8859-7.bdf" iso-8859-7)) ... (normal bdf "new-unicode.bdf"))
With this new definition, Emacs will use the new fonts to print Greek characters.
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")