<!-- $Header: /home/abel/act/Cyrillic-HOWTO/RCS/Cyrillic-HOWTO.sgml,v 1.9 1995/09/17 10:51:01 abel Exp $ -->

<!doctype linuxdoc system>

<article>

<title>The Linux Cyrillic HOWTO
<author> Alexander L. Belikoff, (<tt/abel@wisdom.weizmann.ac.il/)
<date>v2.1, 17 September 1995

<abstract>
This document describes how to set up your Linux box to typeset, view
and print the documents in the Russian language.
</abstract>


<toc>

<sect>Introduction
<p>

This document covers the things you need to successfully typeset, view,
and print documents in Russian. 

The description is targeted primarily to the end
users. While writing it, I tried to keep the things as simple as
possible. On my opinion, it is unfair to overburden the user with the
X Window System or TeX implementation details, because she merely
wants to type or view the nice texts in Russian. However, I don't
describe <em/what/ the X Window System is and <em/how/ to typeset the
documents with TeX and LaTeX. Consequently, having a guru at hand for
the case of potential problems would be an advantage.

There is some conflict between MS-DOG and Un*x Cyrillic codesets. In
MS-DOG, the most popular Cyrillic codeset is Alt (so-called
alternative codeset). In Un*x, however, the traditional codeset with
Russian characters is KOI-8. It is specified in the RFC 1489
(<em/"Registration of a Cyrillic Character Set"/).

The difference in two codesets is usage is pretty minimal (except the
TeX packages). Therefore, we will describe only KOI-8 codeset setup.

I appreciate any comments corrections and suggestions concerning the
document. Don't hesitate to contact me at
<tt/abel@wisdom.weizmann.ac.il/.


<sect>Acknowledgments and copyrights
<p>

Many people helped me (and not only me) with valuable information and
suggestions. Even more people contributed software to the public
community. I am sorry if I have forgotten to mention somebody.

So, here they go: Bas V._de Bakker, David Daves, Serge Vakulenko,
Sergei O. Naoumov, Winfried Truemper.

This document is Copyright (C) 1995 by Alexander L. Belikoff. It may
be used and distributed under the usual Linux HOWTO terms described
below.

The following is a Linux HOWTO copyright notice:

<quote>
<it>Unless otherwise stated, Linux HOWTO documents are copyrighted by their
respective authors. Linux HOWTO documents may be reproduced and distributed 
in whole or in part, in any medium physical or electronic, as long as
this copyright notice is retained on all copies. Commercial redistribution 
is allowed and encouraged; however, the author would like to be notified of 
any such distributions.</it>
</quote>

<quote>
<it>All translations, derivative works, or aggregate works incorporating 
any Linux HOWTO documents must be covered under this copyright notice. 
That is, you may not produce a derivative work from a HOWTO and impose
additional restrictions on its distribution. Exceptions to these rules
may be granted under certain conditions; please contact the Linux HOWTO
coordinator at the address given below.</it> 
</quote>

<quote>
<it>In short, we wish to promote dissemination of this information through as
many channels as possible. However, we do wish to retain copyright on the
HOWTO documents, and would like to be notified of any plans to redistribute
the HOWTOs.</it> 
</quote>

If you have questions, please contact Greg Hankins, the Linux HOWTO 
coordinator, at <tt/gregh@sunsite.unc.edu/. You may finger this
address for phone number and additional contact information.

<sect>Further plans
<p>

The next versions of this document will be accessible on
<tt/sunsite.unc.edu/ and <tt/tsx-11.mit.edu/ in HOWTO directory of the
Linux Document Project.

I am looking forward to include more information on TeX and LaTeX as
well as much more elaborated information on printing.


<sect>Setting up the environment
<p>


<sect1>Console
<p>

All stuff needed for russification of the Linux console is contained
in the kbd package. The package is accessible at <tt/sunsite.unc.edu/ or
<tt/tsx-11.mit.edu/. Usually, that package is already installed (it is a
standard part of at least Slackware distribution).

To setup the Cyrillic stuff, one should do three things:

<enum>
<item>Set the appropriate screen font. This is performed by the
<tt/setfont/ program. The fonts files are placed in
<tt>/usr/lib/kbd/consolefonts</tt>.

<bf/NOTE:/ Never run the <tt/setfont/ program under X or it will hang
your system. This is because it works with low-level video card calls
which X doesn't like.

<item>If you use the font in Alt coding (as I do) then you have to set
up the screen mapping program to perform automatic conversion from Alt
to KOI-8. For that purpose use the <tt/mapscrn/ program and the
<tt>/usr/lib/kbd/consoletrans/koi2alt</tt> file.

<item>Load the appropriate keyboard layout with the <tt/loadkeys/
program.

<item>Output an <em/ESC/(K escape sequence on the screen (<em/ESC/
stands for the Escape character with code 033). Only God knows the
purpose of that combination. I stole it from the 
<url url="file://sunsite.unc.edu/pub/Linux/docs/HOWTO/Danish-HOWTO"
     name="Danish-HOWTO"> (thanks, Thomas Petersen) and it works for me!
</enum>

The following is an example of a script which sets up the Cyrillic
mode for console:

<verb>
#!/bin/bash
#
# load cyrillic defs for console
#
# *** NEVER TRY IT UNDER X!!! ***

loadkeys /usr/lib/kbd/keytables/ru.map
setfont /usr/lib/kbd/consolefonts/Cyr_a8x16
mapscrn /usr/lib/kbd/consoletrans/koi2alt
echo -ne 'ESC(K'	# use the REAL ESCAPE character here !
echo "Use the right Ctrl key to switch the mode..."
</verb>


<sect1>The X Window System
<p>

Like the console mode, the X environment also requires some
setup. This involves setting up the input mode and the X fonts. Both
are being discussed below.


<sect2>The X fonts.
<p>

First of all, you have to obtain the fonts collection having the
Cyrillic glyphs at the appropriate places. 

There is a number of such fonts on the net. The author's favorite one
is the collection <tt/VakuFonts/ created by Serge Vakulenko
(<tt/vak@cronyx.ru/). It can be found in the collection of <url
url="ftp://ftp.funet.fi/pub/culture/russian/comp/xwin" 
name="cyrillic stuff for the X Window System"> where you can find many
useful packages for X.

<bf/Note:/ Apparently, that package is included to the XFree86 version
3.1.2 as well as to the most recent public patch for the X11 Release
6. Unfortunately, the author hasn't had a chance to check it yet.

Usually the X fonts are distributed in the <tt/BDF/ format which is
actually the textual font description. You should compile the fonts to
the <tt/PCF/ format using the <tt/bdftopcf/ command:

<tscreen>
bdftopcf -o name.pcf name.bdf
</tscreen>

It is also possible to compress the compiled font using the
<tt/compress/ program (I am not sure about the <tt/gzip/ support).

Now you should do three things to set everything up:

<enum>
<item>Put the compiled (and possibly compressed) fonts to the specified
directory.
 
<item>Recreate the list of fonts for the directory. Simply <tt/cd/ to it and
run:

<tscreen>
mkfontdir .
</tscreen>

You should run it once. This will upgrade the the fonts catalog file
<tt/fonts.dir/.

<item>If the fonts package provides the file of fonts' aliases (usually
<tt/fonts.alias/) then append it's contents to the fonts' aliases file in
the directory containing the fonts.

<item>If that directory is not already known to the X server,
then you should make it known. To achieve that, add the following
commands to the <tt/xinitrc/ file (either local or global one):

<tscreen>
xset +fp directory_with_fonts
xset fp rehash
</tscreen>

</enum>

After you have made the settings above, you can check the availability
of the new fonts by running the following command:

<tscreen>
xfd -fn fontname
</tscreen>

This should show the table of characters of the specified font.


<sect2>The input translation
<p>

The switching between the different input translations is set up by
the <tt/xmodmap/ program. This program allows customization of codes
emitted by various characters and their combinations. It sets the
things up based on the file containing the translation table, usually
<tt>~/.Xmodmap</tt>. 

The following is a simplified description of input customization. If
you want to do more sophisticated tricks, refer to the <bf/xmodmap(1)/
or, even better, wait for the X11 Release 7 which will address the
current input problems.

In our case, the translation table should define two things:

<itemize>
<item>the character codes emitted by the alphanumeric characters, and
<item>the mode switching rules
</itemize>

<sect3>The table of characters
<p>

This is basically a sequence of directives which assign the certain
keysyms to a specified keycodes. The general syntax is the following:

<quote>
<tt/keycode/ <it/code/ <tt/=/ <it/sym1 sym2 sym3 sym4/
</quote>

where <it/code/ is the numerical code of the given key on the keyboard
(refer to the standard table for your system. In my case it is stored
in the file <tt>/usr/lib/X11/etc/xmodmap.std</tt>). The <it/sym/s
define the keysyms emitted by that key in different
conditions. <it/Sym1/ is the keysym emitted by the key in a regular
state, <it/sym2/ corresponds the key 
in <it/shifted/ state (usually when <tt/Shift/ is held down). <it/Sym3/
and <it/sym4/ define the keysyms emitted when the <tt/Mode_switch/ is
active for the normal and shifted states respectively (<it/group 2/,
according the X Protocol Specification). In our case,
the active <tt/Mode_switch/ corresponds to the Cyrillic input mode.

These should be either hexadecimal codes or the symbolic constants
from <tt>/usr/include/X11/keysymdef.h</tt> (without leading "XK_"). 

Thus, if we wanted the key corresponding to the Latin 'a'
generate the Russian 'a' in the alternative mode, we would write the
following:

<verb>
keycode 38  =  a  A  0xC1 0xE1
</verb>

The reader might be curious why I haven't used the <tt/Cyrillic_a/ and
<tt/Cyrillic_A/ constants respectively. The answer is that it didn't
work for me. I am not very familiar with the guts of the X Window
System specification, but I have the following explanation. The
symbolic constants above have the values <tt/0x6C1/ and <tt/0x6E1/
respectively. This means that in really multi-lingual environment they
could be successfully used without overlapping with any other
character set. However the KOI-8 standard is not well suited for such
environment. Thus, since we want to retain compatible with the past,
we will violate the rules of multi-lingual support in the X Window
System.

The following is a table for the most popular russian JCUKEN keyboard
layout (these tables are derived from the ones in the <tt/VakuFonts/
package):

<verb>
keysym  4             = 4               dollar          4       quotedbl
keysym  5             = 5               percent         5       colon
keysym  6             = 6               asciicircum     6       comma
keysym  7             = 7               ampersand       7       period
keysym  q             = q               Q               0xCA    0xEA
keysym  w             = w               W               0xC3    0xE3
keysym  e             = e               E               0xD5    0xF5
keysym  r             = r               R               0xCB    0xEB
keysym  t             = t               T               0xC5    0xE5
keysym  y             = y               Y               0xCE    0xEE
keysym  u             = u               U               0xC7    0xE7
keysym  i             = i               I               0xDB    0xFB
keysym  o             = o               O               0xDD    0xFD
keysym  p             = p               P               0xDA    0xFA
keysym  bracketleft   = bracketleft     braceleft       0xC8    0xE8
keysym  bracketright  = bracketright    braceright      0xDF    0xFF
keysym  a             = a               A               0xC6    0xE6
keysym  s             = s               S               0xD9    0xF9
keysym  d             = d               D               0xD7    0xF7
keysym  f             = f               F               0xC1    0xE1
keysym  g             = g               G               0xD0    0xF0
keysym  h             = h               H               0xD2    0xF2
keysym  j             = j               J               0xCF    0xEF
keysym  k             = k               K               0xCC    0xEC
keysym  l             = l               L               0xC4    0xE4
keysym  semicolon     = semicolon       colon           0xD6    0xF6
keysym  apostrophe    = apostrophe      quotedbl        0xDC    0xFC
keysym  grave         = grave           asciitilde      0xA3    0xB3
keysym  z             = z               Z               0xD1    0xF1
keysym  x             = x               X               0xDE    0xFE
keysym  c             = c               C               0xD3    0xF3
keysym  v             = v               V               0xCD    0xED
keysym  b             = b               B               0xC9    0xE9
keysym  n             = n               N               0xD4    0xF4
keysym  m             = m               M               0xD8    0xF8
keysym  comma         = comma           less            0xC2    0xE2
keysym  period        = period          greater         0xC0    0xE0
</verb>

Also, for those using the russian YAWERTY layout, I've included the
following table:

<verb>
keysym  q             = q               Q               0xD1    0xF1
keysym  w             = w               W               0xD7    0xF7
keysym  e             = e               E               0xC5    0xE5
keysym  r             = r               R               0xD2    0xF2
keysym  t             = t               T               0xD4    0xF4
keysym  y             = y               Y               0xD9    0xF9
keysym  u             = u               U               0xD5    0xF5
keysym  i             = i               I               0xC9    0xE9
keysym  o             = o               O               0xCF    0xEF
keysym  p             = p               P               0xD0    0xF0
keysym  bracketleft   = bracketleft     braceleft       0xDB    0xFB
keysym  bracketright  = bracketright    braceright      0xDD    0xFD
keysym  a             = a               A               0xC1    0xE1
keysym  s             = s               S               0xD3    0xF3
keysym  d             = d               D               0xC4    0xE4
keysym  f             = f               F               0xC6    0xE6
keysym  g             = g               G               0xC7    0xE7
keysym  h             = h               H               0xC8    0xE8
keysym  j             = j               J               0xCA    0xEA
keysym  k             = k               K               0xCB    0xEB
keysym  l             = l               L               0xCC    0xEC
keysym  z             = z               Z               0xDA    0xFA
keysym  x             = x               X               0xD8    0xF8
keysym  c             = c               C               0xC3    0xE3
keysym  v             = v               V               0xD6    0xF6
keysym  b             = b               B               0xC2    0xE2
keysym  n             = n               N               0xCE    0xEE
keysym  m             = m               M               0xCD    0xED
keysym  backslash     = backslash       bar             0xDC    0xFC
keysym  grave         = grave           asciitilde      0xC0    0xE0
keysym  equal         = equal           plus            0xDE    0xFE
keysym  3             = 3               numbersign      3       0xDF
keysym  4             = 4               dollar          4       0xFF
</verb>


<sect3>The mode switching rules
<p>

This is basically the trickiest part of the X Cyrillic setup. You
should define the conditions in which the current mode is switched
between the regular and the Cyrillic one.

There are two ways to achieve that in Linux. One is XFree86-specific,
while the other is more general (well, not too much, as I'll show
below).

The XFree86-specific way is the following. There are two virtual
actions which can be assigned to the keys in the <tt/XF86Config/ file:
<tt/ModeShift/ which changes to the mode alternative to the regular
one without locking, and <tt/ModeLock/ 
which does the same but with locking. In the first case the keys will
emit the alternative keysyms only when the key generating the
<tt/ModeShift/ is held down, whereas in the latter case the user needs
to press the key generating the <tt/ModeLock/ keysym only once and the
keyboard will be generating the alternative keysyms until that key is
pressed for a second time. You should assign the <tt/ModeShift/ and
<tt/ModeLock/ keysyms to the keys you want to work the mode switches.

Thus, if one wants to assign the <tt/ModeShift/ action to the right
Alt key, she should place the following directive in her XF86Config:

<verb>
RightAlt	ModeShift
</verb>

Similarly, if the action required was ModeLock, the directive would
be:

<verb>
RightAlt	ModeLock
</verb>

See the <bf>XF86Config(4/5)</bf> for more details.

The other way is, again, to use the <tt/xmodmap/ utility. This is much
more tricky. Basically what you should do is:

<itemize>
<item>Assign the <tt/Mode_switch/ keysym to some key, and
<item>Add <tt/Mode_switch/ to some spare modifier map
</itemize>

Now the key to which the <tt/ModeShift/ is assigned will act as a mode
switch. This means that while it is held down, the keyboard is in
alternative mode.

Moreover, if you add a <it/lockable/ key to that modifier's map, this
key will lock the alternative mode.

<bf/Note:/ There are some problems however. Serge Vakulenko
(<tt/vak@cronyx.com/) pointed out that the different X Server
implementations may have different rules of assignments the mode
switches (like, for example, some servers restrict the set of the keys
which may work in toggle mode to, say, <tt/CapsLock/, <tt/NumLock/,
and <tt/ScrollLock/). Hopefully, this is a subject to change in the
next release of the X Window System. For more details, see the X
Protocol specification.

Let's see an example. Suppose, one wants to use the right Alt as a
mode switch and the ScrollLock as as a mode lock. First of all, one
should check the default modifiers' map. This is accomplished by
running the <tt/xmodmap/ without arguments:

<tscreen><verb>
$ xmodmap

xmodmap:  up to 2 keys per modifier, (keycodes in parentheses):

shift       Shift_L (0x32),  Shift_R (0x3e)
lock        Caps_Lock (0x42)
control     Control_L (0x25)
mod1        Alt_L (0x40),  Alt_R (0x71)
mod2        Num_Lock (0x4d)
mod3      
mod4      
mod5
</verb></tscreen>

According to the above, the plan of attack is the following:

<enum>
<item>remove the <tt/Alt_R/ key from the <tt/mod1/ map
<item>assign the <tt/Mode_switch/ keysym to the <tt/Alt_R/ key
<item>assign the <tt/Scroll_Lock/ keysym to the keycode 78 (the code
of the <it/actual/ ScrollLock)
<item>add the <tt/Mode_switch/ to the spare (<tt/mod3/) map, and
<item>add the <tt/Scroll_Lock/ keysym to the <tt/mod3/ map
</enum>

Thus, here is the solution:

<verb>
remove mod1 = Alt_R
keysym Alt_R = Mode_switch
keycode 78 = Scroll_Lock
add mod3 = Mode_switch
add mod3 = Scroll_Lock
</verb>

If you use the latter solution, you may combine both the table and the
mode directives in your <tt>~/.Xmodmap</tt> file.

Such files are generally supplied with the various X Cyrillic stuff
packages. The good example is the tables in the perfect package by
Serge Vakulenko described above.

Once you have such file containing the table, you should run the
command:

<tscreen>
xmodmap filename
</tscreen>

every time you start X. Modify your <tt/.xinitrc/ file to perform
it. <bf/NOTE:/ your <tt/.xinitrc/ can already contain the code to run the
<tt/xmodmap/ over your local table if the one exists.

The table distributed with the Serge's Vakulenko package didn't work
for the author. The following patch fixed the problem:

<verb>
diff -u --new-file jcuken.xmm jcuken.xmm.mod
--- jcuken.xmm	Mon May 20 09:11:36 1991
+++ jcuken.xmm.mod	Sun Aug 13 15:44:06 1995
@@ -2,6 +2,8 @@
 ! Cyrillic keyboard mapping table.
 ! Produced by Serge Vakulenko, <vak@kiae.su>, Moscow.
 !
+! Modified by Alexander L. Belikoff (abel@wisdom.weizmann.ac.il), 1995
+!
 ! Russian JCUKENG keyboard layout implemented. 
 ! Cyrillic characters are entered in koi8 encoding.
 !
@@ -10,7 +12,9 @@
 
 ! Use CapsLock as rus/lat switch key.
 remove lock = Caps_Lock
-add mod2 = Caps_Lock
+keysym Caps_Lock = Mode_switch
+add mod2 = Mode_switch
+add lock = Mode_switch
 
 !       Key             Base            Shift           Caps    ShiftCaps
 !------------------------------------------------------------------------
</verb>

This allowed me to use the Caps Lock key to switch between normal and
Cyrillic input modes.


<sect>Cyrillic support in LaTeX
<p>

In this section I'll describe the procedure of making LaTeX typeset
Russian. LaTeX is a macro package for TeX offering the user many
useful styles, templates, and commands. If you are making your mind on
what package to use, I personally suggest LaTeX. Moreover, there are
two versions of LaTeX available - 2.09 is the old one, while 2e is a
new pre-3.0 release. If you are using LaTeX 2.09, then switch quickly
to the 2e. The latter retains compatibility with the old one, but has
much more features. Hopefully, version 3 will be released soon. So far
I describe the LaTeX 2e setup.

I have an experience with two packages. One is the <tt/cmcyralt/
package by Vadim V. Zhytnikov (<tt/vvzhy@phy.ncu.edu.tw/) and
Alexander Harin (<tt/harin@lourie.und.ac.za/), and the other is the
<tt/LH/ package by the <em/CyrTUG/ group
with styles and hyphenation for LaTeX2e by Sergei O. Naoumov
(<tt/serge@astro.unc.edu/). I'll describe both.

<bf/Note:/ Both of these packages require the Cyrillic text to be
typeset using the <em/Alt/ codeset, not <em/KOI-8/! This is caused by
historical reasons, since the creators of these packages used to work
with <tt/EmTeX/ - the MS-DOG version of TeX (they didn't know about Linux
yet :-). Switching to the <em/KOI-8/ requires some effort and is being
expected to be done soon. So far, use some utility to convert your
russian text from <em/KOI-8/ to <em/Alt/. See section <ref
id="user-tools" name="User's tools">.


<sect1>Using the cmcyralt package
<p>

The <tt/cmcyralt/ package can be found on any CTAN (Comprehensive TeX
Archive Network) site like <tt/ftp.dante.de/. You should get two
collections: the fonts collection from <tt>fonts/cmcyralt</tt> and the
styles and hyphenation rules from
<tt>macros/latex/contrib/others/cmcyralt</tt>.

<bf/Note:/ Make sure you have the <tt/Sauter/ package installed, since
<tt/cmcyralt/ requires some fonts from it. You can get this package
from CTAN site as well.

Now you should do the following:

<enum>
<item>Put the new fonts to the TeX fonts tree. On my system (Slackware
2.2) I created a <tt/cmcyralt/ directory in the
<tt>/usr/lib/texmf/fonts/cm/</tt>. Create the <tt/src/, <tt/tfm/, and
<tt/vf/ subdirectories in it. Put there <tt/.mf/, <tt/.tfm/, and
<tt/vf/ files respectively.
<item>Put the font driver files (<tt/*.fd/) from the styles archive to the
appropriate place (in my case it was
<tt>/usr/lib/texmf/tex/latex/fd</tt>).
<item>Put the style files (<tt/*.sty/) to the appropriate LaTeX styles
directory (in my case <tt>/usr/lib/texmf/tex/latex/sty</tt>).
</enum>

Now the hyphenation setup. This requires to remake the LaTeX base
file.

<enum
<item>The file <tt/hyphen.cfg/ contains the directives for both
English and Russian hyphenation. Extract the one for Russian and place
it to the LaTeX hyphenation config file <tt/lthyphen.ltx/. In my case,
that file was in <tt>/usr/lib/texmf/tex/latex/latex-base</tt>.

<item>Put the <tt/rhyphen.tex/ to the same directory. It is needed for
making the new base file. Later, you can remove it.

<item>Do '<tt/make/' in that directory. Don't for get to make a link
from <tt/Makefile/ to <tt/Makefile.unx/. During the make process check
the output. There should be a message:

<verb>
Loading hyphenation patterns for Russian.
</verb>

If everything goes OK, you will get the new <tt/latex.fmt/ in that
directory. Put it to the appropriate place, where the previous one was
(like <tt>/usr/lib/texmf/ini/</tt>). <bf/Don't forget to save the
previous one!/.
</enum>

This is it. The installation is complete. Try processing the examples
found in the styles archive. If you are to create the PostScript files
without any problems, then everything is OK. Now, to use Cyrillic in
LaTeX, prepend your document with the following directive:

<verb>
\usepackage{cmcyralt}
</verb>

For more details, see the <tt/README/ file in the <tt/cmcyralt/ styles
archive.

<bf/Note:/ if you do have problems with the examples, provided you
have installed the things right, then probably your TeX system hasn't
been installed correctly. For example, during my first try, every
attempt to create the <tt/.pk/ files for the russian fonts failed
(<tt/MakeTeXPK/ stage). A substantial investigation discovered some
implicit conflict between the <it/localfont/ and <it/ljfour/
<tt/METAFONT/ configurations. It used to work before, but kept
crashing after the <tt/cmcyralt/ installation. Contact your local TeX
guru - TeX is very (sometimes too much) complicated to reconfigure it
without any prior knowledge.


<sect1>Using the CyrTUG package
<p>

You can obtain the CyrTUG package from the <url
url="ftp://sunsite.unc.edu/pub/academic/russian-studies/Software"
name="SunSite archive">. Get the files <tt/CyrTUGfonts.tar.gz/,
<tt/CyrTUGmacro.tar.gz/, and <tt/hyphen.tar.Z/.

The process of installation doesn't differ from the previous one.


<sect>Miscellaneous utilities setup
<p>

Generally, to set the certain utility up to handle the Cyrillic
requires just to allow the 8 bit input. In some cases it is required
to tell the application to show the extended ASCII characters in their
"native" form. 

<sect1>bash
<p>

Three variables should be set on order to make <tt/bash/ understand the
8-bit characters. The best place is <tt>~/.inputrc</tt>
file. The following should be set:

<verb>
set meta-flag on
set convert-meta off
set output-meta on
</verb>


<sect1>csh/tcsh
<p>

The following should be set in <tt/.cshrc/:

<verb>
setenv LC_CTYPE iso_8859_5
stty pass8
</verb>

If you don't have the POSIX <tt/stty/ (impossible for Linux), then
replace the last call to the following:

<verb>
stty -istrip cs8
</verb>


<sect1>emacs<label id="emacs">
<p>

The minimal cyrillic support in <tt/emacs/ is done by adding the following
calls to one's <tt/.emacs/ (provided that the Cyrillic character set
support is installed for console or X respectively):

<verb>
(standard-display-european t)

(set-input-mode (car (current-input-mode))
   (nth 1 (current-input-mode))
   0)
</verb>

This allows the user to view and input documents in Russian.

However, such mode is not of a big convenience because <tt/emacs/ doesn't
recognize the usual keyboard commands while set in Cyrillic input
mode. There are a number of packages which use the different
approach. They don't rely on the input mode stuff established by the
environment (either X or console. Instead, they allow the user to
switch the input mode by the special <tt/emacs/ command and <tt/emacs/
itself is responsible for re-mapping the character set. The author
took a chance to look at three of them. The <tt/russian.el/ package by
Valery Alexeev (<tt/ava@math.jhu.edu/) allows the user to switch
between cyrillic and regular input mode and to translate the contents
of a buffer from one Cyrillic coding standard to another (which is
especially useful while reading the texts imported from MS-DOG). The
<tt/rustable.el/ (sorry, I don't know the author of it) adds the
syntax rules of Cyrillic codeset to <tt/emacs/ (words' bounds, case
change rules etc.) These packages can be found at most Emacs-Lisp
archives. Another one is the package <tt/remap/ which tries to 
make such support more generic. This package is written by Per
Abrahamsen (<tt/abraham@iesd.auc.dk/) and is accessible at
<tt/ftp.iesd.auc.dk/.

As for the author's opinion, I would suggest to start using the
<tt/russian.el/ package because it is very easy to setup and use.


<sect1>ispell
<p>

Check the
<tt>sunsite.unc.edu:/pub/academic/russian-studies/Software</tt> for
the russian dictionary created by Neal Dalton (<tt/nrd@cray.com/) for
the <tt/ispell/ package.


<sect1>less
<p>

So far, <tt/less/ doesn't support the KOI-8 character set, but the
following environment variable will do the job:

<verb>
LESSCHARSET=latin1
</verb>


<sect1>Netscape
<p>

Set the following resource:

<verb>
*documentFonts*registry:	koi8
</verb>


<sect1>rlogin
<p>

Use '<tt/rlogin -8/'


<sect>Printing
<p>

To print the text files containing the Russian characters using on
PostScript printers, you need two things: the fonts and the 8bit-aware
software able to print the texts using those fonts. The best 
package to print the text files in PostScript is <tt/a2ps/ by Evan
Kirshenbaum (<tt/evan@csli/) and Miguel Santana
(<tt/miguel@imag.imag.fr/). The last version is 8bit-aware. You can
get it from <tt>imag.imag.fr:/archive/postscript/</tt>.

Check the
<tt>sunsite.unc.edu:/pub/academic/russian-studies/Software/</tt> in
order to obtain the Cyrillic PostScript fonts. Also, there is a lot of
fonts in the <url url="ftp://oak.oakland.edu/pub/SimTel/" name="SimTel">
collection.


<sect>Useful Tools
<p>

<sect1>User's tools<label id="user-tools">
<p>

There are number of programs able to convert from <em/KOI-8/ to
<em/Alt/ and back. You can even use the special mode for <tt/emacs/
(see section <ref id="emacs" name="Emacs">).

One nice standalone package is <tt/translit/. It is available at the
<url url="ftp://sunsite.unc.edu/pub/academic/russian-studies/Software" 
name="SunSite archive">. This package is capable of converting between
different formats including the <em/KOI-8/ and the <em/Alt/ ones.

<sect1>Programmer's tools<label id="programmers-tools">
<p>

So far, I explained the ways to make the programs accept and display
the Cyrillic codeset. However the full <em/localization/ of the system
comprises much more. All discussed above is not enough. The system
should be friendly for a user who doesn't necessarily speak
English. In my own opinion, it is not a big deal to become familiar
with English at the level of the programs' messages. However, it is
not quite fair to require it.

Thus, the next level of localization requires the programs to be
customizable to the requirements of different languages and data
representation habits.

Before, that was done by developing some abstraction of the messages
to output from the program's code. Now, such mechanism is (more or
less) standardized. And, of course, there are free implementations of
it!

The good news is that GNU finally adopted the way of making the
internationalized applications. Ulrich Drepper
(<tt/drepper@ipd.info.uni-karlsruhe.de/) developed a package
<tt/gettext/. This package is available at all GNU sites like <url
url="ftp://prep.ai.mit.edu/pub/gnu/" name="prep.ai.mit.edu">. It
allows you to develop programs in the way that you can easily make
them support more languages. I don't intend to describe the
programming techniques, especially because the <tt/gettext/ package
is delivered with excellent manual.

So, if you are developing programs which output messages (have you
ever developed any program which didn't?), then don't be lazy to put a
little (yes, really little) effort to make your program locale-aware.

<bf/Request for collaboration:/ If you want to learn the <tt/gettext/
package and to contribute to the GNU project simultaneously; or even
if you just want to contribute, then you can do it! GNU goes
international, so all the utilities are being made locale-aware. The
problem is to translate the messages from English to Russian (and
other languages if you'd like). Basically, what one has to do is to
get the special <tt/.po/ file consisting of the English messages for a
certain utility and to append each message with it's equivalent in
Russian. Ultimately, this will make the system speak Russian if the
user wants it! For more details and further directions contact Ulrich
Drepper (<url url="mailto:drepper@ipd.info.uni-karlsruhe.de"
name="drepper@ipd.info.uni-karlsruhe.de">).

<!--

<sect>Notes for developers
<p>

-->

<sect>Summary of the various useful resources
<p>

<url url="ftp://ftp.iesd.auc.dk/"
     name="The remap package for Emacs">

<url url="ftp://ftp.funet.fi/pub/culture/russian/comp/xwin"
     name="Many fonts collections for X">

<url url="http://sunsite.oit.unc.edu/sergei/Software/Software.html"
     name="Information on Cyrillic Software">

<url url="ftp://sunsite.unc.edu/pub/academic/russian-studies/Software"
     name="Useful Cyrillic packages">

<url url="ftp://sunsite.unc.edu/pub/Linux/system/Keyboards/"
     name="The kbd package for Linux">

<url url="ftp://ftp.switch.ch/mirror/linux/X11/fonts/"
     name="X fonts collections">

<url
url="ftp://sunsite.unc.edu/pub/academic/russian-studies/Software/rspell.tar.gz"
     name="rspell">

</article>
