# Dmitri Pavlov's Plain TeX macros

## Unicode Plain TeX with UTF-8 encoding

UTF-8 Plain TeX
This file provides mapping from a part of Unicode's code space encoded in UTF-8 into TeX commands. Most of TeX's \chardef/\mathchardef definitions are covered. See comments in the file for exceptions. Current experimental version only has support for math symbols and a few letters and punctuation signs. So far there is no support for accented letters.

## Russian Plain TeX

### Contents of the package

Russian Plain TeX
This file contains Russian modifications for Plain TeX. The following aspects are covered:
• Computer Modern fonts are replaced by LH fonts, which coincide with CM fonts in the ASCII range and add Russian letters and six other characters (№¤§„«»). Unfortunately, for some strange reason LH fonts do not have math italic Russian letters, therefore you should substitute italic fonts for math italic in this case. For example, to typeset Ш=ж+щ you have to type $\it Ш=ж+щ$. You can find LH fonts on CTAN website.
• Russian hyphenation is available simultaneously with English hyphenation. Due to disjoint character codes of English and Russian there is no need for TeX's language mechanism. You have to input a file with a set of Russian hyphenation patterns after loading plain-ru.tex. You can find several Russian hyphenation patterns on CTAN website.
• Russian letter codes are set properly, including
• category codes (you can use Russian letters in command names);
• upper and lower case codes (\uppercase and \lowercase work with Russian letters);
• space factor codes (Russian letters enjoy proper spacing);
• math codes (you can use Russian letters in formulas with all fonts except for math italic, as explained above).
Russian codes for LH fonts
This file contains codes for all additional characters of LH fonts as compared to CM fonts. Please note that six nonalphabetic characters might not be present in your character set, therefore you might need to adjust them manually.

If you want to use the A4 paper size, add the following two lines to your TeX source:
\hsize=159.4241038mm
\vsize=243.9617787mm

### How to install this package

1. Download plain-ru.tex and lhcodes.mf and recode them into an appropriate encoding. Example for the KOI8-R encoding:
curl http://dmitripavlov.org/tex/lhcodes.mf | 9 tr №¤§„«» ─│┌┐└┘ | iconv -t koi8-r >lhcodes.mf
curl http://dmitripavlov.org/tex/plain-ru.tex | iconv -t koi8-r >plain-ru.tex
We have to use tr from Plan 9, because the standard GNU tr does not support UTF-8.
2. Use INITEX to load plain-ru.tex together with some set of Russian hyphenation patterns and then perform dump. Example:
initex '\input plain-ru \input ruhyphal \dump'
Here we used patterns from the ruhyphal.tex file.
3. Place the resulting plain-ru.fmt file in the appropriate directory.
4. Now use tex -fmt plain-ru to compile a file. Alternatively, in several distributions you can setup a symbolic link to the tex executable with the same name as the corresponding .fmt file.

### Issues to resolve

To complete the adaptation of Plain TeX to Russian I need to find Russian math italic fonts that are compatible in style with the CM and LH fonts. Can anyone recommend any fonts?

## Russian CWEB

I was unsatisfied with the poor quality of the existing adaptations of CWEB to the Russian language and decided to make my own translation. Here is the result: Russian macros for CWEB. All built-in English phrases are translated. LH fonts are used.

If you want to use the A4 paper size with CWEB, add the following four lines to your source:
\pagewidth=159.4241038mm
\pageheight=243.4537787mm
\fullpageheight=244.2157787mm
\setpage

## Encoding issues

All files on this page use the UTF-8 encoding. To use some other encoding, just recode them. If you are using standard 8-bit versions of TeX and METAFONT, you must recode plain-ru.tex and lhcodes.mf to a single-byte encoding. The file lhcodes.mf might require minor additional modifications, follow the instructions in this file.

## Contact

Feedback welcome by email.