Here is the minimal procedure to use this package.
Download the tarball and untar it under your home directory.
% cd % tar xfvz cgreek21.tar.gz
The above operations create the directory ~/cgreek21 and save all the necessary files there.
The current CGreek package includes two Unicode fonts to display polytonic Greek characters. Copy ~/cgreek21/bdf/cgreek16-unicode.bdf to an appropriate font directory, e.g. /usr/lib/X11/fonts/misc, and run the mkfontdir command in that directory. Leave the other font, ~/cgreek21/bdf/cgreek24-unicode.bdf, in that directory.
Add the following lines at the end of your ~/.emacs file.
(setq load-path (cons "~/cgreek21" load-path)) (load "cgreek")
Start Emacs with the option -fn fontset-standard. Then select CGreek → Open TeX File from the menu bar and type ~/cgreek21/sample.tex for the filename. Do you see an example of multilingual text?
So far, you have installed the core part of the CGreek package. Now you can display, enter, edit, and print multilingual text that contains Greek characters. Basic requirements are fulfilled with these functions. To get more advanced features, however, there are more procedures to be done.
If you want to read the TLG CD-ROM, you also need to install two converter programs. See Using TLG CD-ROM below.
To print Greek text with TeX, you must have Ibycus4 Greek TeX package. See Printing with TeX below for the details.
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.
aj = <alpha> <terminal sigma> aJ = <alpha + iota subscriptum>
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 | ancient character |
|---|---|
| ! | Sampi |
| # | Digamma |
| $ | Stigma |
| % | qoppa |
| & | Qoppa |
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 provided 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 ' → <a + acute> (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 ' → <a + acute> (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.
CGreek21 comes with three patched Emacs Lisp files (ps-bdf.el, ps-print.el and ps-mule.el) that enable printing Greek characters as well as other characters. They convert the buffer content into PostScript and send it to the specified printer. Follow the instruction below to get a hardcopy of an Emacs buffer.
First, you must specify the name of the PostScript printer. This is done by putting the following line in your ~/.emacs file.
(setq ps-printer-name "ps")
Do not forget to replace the printer name "ps" with the name of your PostScript printer.
If you omit this procedure, the default printer (a printer named lp or the one specified by the environment variable PRINTER) is used for printing.
Selecting the menu CGreek → Print Buffer converts the entire buffer into PostScript and sends it to the specified 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.
By default, these printing functions use the bitmap font etl24-unicode.bdf, which also comes with CGreek21, to print Greek characters. Therefore the quality of Greek characters is worse than that of Latin and Japanese characters, for which builtin PostScript fonts are used.
The printing quality is greatly 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.
CGreek21 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 tlg2emacs and tlg2cit. See the section Using TLG CD-ROM for details.
Save the current buffer converting Greek characters into Ibycus4 LaTeX commands and accented Latin characters into standard LaTeX commands. This is the recommended format, even for those who are not using LaTeX and Ibycus4 because the created file contains only plain text.
Save multilingual text in the UTF-8 format. Han characters cannot be saved in UTF-8 without a help of other facility, e.g. mule-UCS.
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 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.
The first thing you have to do is compile tlg2emacs and tlg2cit. You need a C development environment, i.e., a C compiler, make, lex, etc. Most of the UNIX based systems are equipped with such an environment, but you may need to install one yourself if you are using Solaris or Windows. You probably need flex (the GNU version of lex).
The compilation procedure is very simple; just cd to ~/cgreek21 and issue the command make. The program tlg2emacs and tlg2cit are created and put in that directory to be used later by Emacs.
Note that tlg2emacs is not a perfect converter; it ignores some additional information (font size, special parentheses, unusual symbols, etc.) recorded on the TLG CD-ROM. If you are familiar with beta code, you may want to write your own converter program to utilise these informations. See Customising TLG Converter to use your own converter program instead of the default tlg2emacs.
The commands for reading TLG files assume that the TLG CD-ROM is mounted on the directory /cdrom. In other words, files must be accessible with the pathnames like /cdrom/authtab.dir, /cdrom/tlg0059.txt, etc. If this is not the case on your system, remove the leading semicolon of the following line in the ~/cgreek21/cgreek.el file and change the string "/mnt/cdrom" to an appropriate one for your system.
;(setq cgreek-tlg-directory "/mnt/cdrom")
If you are using TLG CD-ROM volume D, remove the leading semicolon of the following line in the ~/cgreek21/cgreek.el file.
;(setq cgreek-tlg-cdrom-version "D")
The default value of this variable is "E".
Now 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 four digits 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 "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 authors) 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 CGreek21 package supports TeX file I/O in the Ibycus4 style. To fully benefit from this capability, you need to install LaTeX2e and Ibycus4 on your system. LaTeX2e is available for most distributions. Ibycus4 can be installed in various ways depending on your operating system.
Issue the following command as root and everything is done.
# apt-get install texlive-lang-greek
Follow the instructions below if you are installing CGreek21 on Vine Linux 4.1.
$ wget ftp://ftp.ring.gr.jp/pub/text/CTAN/fonts/greek/ibygrk.zip $ unzip ibygrk.zip $ cd ibygrk $ su # cp -r doc/* /usr/share/texmf/doc/ # cp -r fonts/* /usr/share/texmf/fonts/ # cp -r tex/* /usr/share/texmf/tex/
Then rewrite line 48 in /usr/share/texmf/dvips/config/config.ps from
% p +myfonts.map
to
p +iby.map
Finally, issue the following commands.
# cp ./fonts/map/dvips/ibycus4/iby.map /usr/share/texmf/fonts/map/dvips/ # cp ./fonts/map/dvips/ibycus4/iby.map /usr/share/texmf/fonts/map/dvipdfm/ # cp ./fonts/map/dvips/ibycus4/iby.map /usr/share/texmf/fonts/map/xdvi # mktexlsr # updmap --enable Map=iby.map
Follow the instructions below if you are using teTex-2 included in Vine Linux 3.2.
$ wget ftp://ftp.ring.gr.jp/pub/text/CTAN/fonts/greek/ibygrk.zip $ unzip ibygrk.zip $ cd ibygrk $ su # mkdir -p /usr/share/texmf-local # cp -rfvp doc /usr/share/texmf-local/ # cp -rfvp fonts /usr/share/texmf-local/ # cp -rfvp tex /usr/share/texmf-local/ # mktexlsr # updmap --enable Map=iby.map
If you have installed teTex-3 (ptetex3) by yourself, change the commands after 'su' as the followings.
# mkdir -p /usr/local/teTeX/share/texmf-local # cp -rfvp doc /usr/local/teTeX/share/texmf-local/ # cp -rfvp fonts /usr/local/teTeX/share/texmf-local/ # cp -rfvp tex /usr/local/teTeX/share/texmf-local/ # mktexlsr # updmap-sys --enable Map=iby.map
Download Ibycus4 from a CTAN mirror site, for example,
Read the README file in the Ibycus4 package for installation.
Selecting CGreek → Save TeX File from the menu bar saves the current buffer into a file converting Greek characters into Ibycus4 commands and accented Latin characters into standard LaTeX commands. Characters in other character sets, e.g., Japanese characters, are left unchanged.
In the file, each segment of consecutive Greek characters is converted into Ibycus4 commands and is surrounded by \begin{greek} and \end{greek}. Accented Latin characters are converted into standard LaTeX commands representing those characters. The window, however, keeps on displaying Greek and accented Latin characters as they are.
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 single 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 written by hand 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 value of the following variables are checked to invoke the corresponding input method.
| input | 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 | japanese-egg-wnn |
| 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 ~/cgreek21/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 |
| key | punctuation |
|---|---|
| , | Greek comma |
| . | Greek full-stop |
| ? | Greek question mark |
| ; | Greek colon |
| (( | parenleft |
| )) | parenright |
| key | ancient character |
|---|---|
| s+ | lower sampi |
| V | upper digamma |
| k+ | lower koppa |
| K+ | upper koppa |
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 a bigger bdf font to get better quality in printing Greek characters. A font 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 xmbdfed has a good user interface for font design. Both programs should be easily found using a Web search engine.
Once you have created a new bdf font, save it under the directory ~/cgreek21/bdf with an arbitrary name, say, mycgreek.bdf.
Then rewrite the file ~/cgreek21/cgreek.el. Look for the following line.
(normal bdf "etl24-unicode.bdf" ps-mule-encode-ucs2 2))
Replace the string "etl24-unicode.bdf" with "mycgreek.bdf" so that the line looks like the following.
(normal bdf "mycgreek.bdf" ps-mule-encode-ucs2 2))
With this new definition, Emacs will use mycgreek.bdf to print Greek characters.
The variable cgreek-tlg2emacs-program specifies the program that perform TLG conversion. Its default value is the string "~/cgreek21/tlg2emacs", thus pointing the default converter program tlg2emacs.
The source program is ~/cgreek21/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")