% Plain format adapted to the Russian language.
% Copyright 2008, 2012 Dmitri Pavlov.
% You may redistribute this file under the terms of GNU General Public License version 3.
% Report bugs and suggestions to me: host: math.berkeley.edu, user: pavlov.

% To compile, load this file, load some set of Russian hyphenation patterns, and perform dump.
% Typical compilation command: initex '\input plain-ru \input ruhyphal \dump'

% This file is in the UTF-8 encoding.
% If you want to use some other encoding, just recode this file.
% In particular, you have to recode to a single-byte encoding if you are using a standard version of TeX.

% This file uses the LH fonts by Olga Lapko and Andrei Hodulev.
% If you want to use some other fonts, simply change the lh prefix everywhere to the prefix of your font.

% This macro package sets up proper codes (cat, uc, lc, sf, math) and fonts (LH) for the Russian language.
% Unfortunately, the LH package does not have Russian mathematical fonts.
% You probably want to input a set of Russian hyphenation patterns after loading this file.

\catcode`\{=1
\catcode`\}=2
\let\xskewchar=\skewchar
\def\skewchar{\let\skewchar=\xskewchar\let\xskewchar=\undefined

\message{russian fonts,}
\font\tenrm=lhr10 % roman text
\font\preloaded=lhr9
\font\preloaded=lhr8
\font\sevenrm=lhr7
\font\preloaded=lhr6
\font\fiverm=lhr5

\font\preloaded=lhss10 % sans serif
\font\preloaded=lhssq8

\font\preloaded=lhssi10 % sans serif italic
\font\preloaded=lhssqi8

\font\tenbf=lhbx10 % boldface extended
\font\preloaded=lhbx9
\font\preloaded=lhbx8
\font\sevenbf=lhbx7
\font\preloaded=lhbx6
\font\fivebf=lhbx5

\font\tentt=lhtt10 % typewriter
\font\preloaded=lhtt9
\font\preloaded=lhtt8

\font\preloaded=lhsltt10 % slanted typewriter

\font\tensl=lhsl10 % slanted roman
\font\preloaded=lhsl9
\font\preloaded=lhsl8

\font\tenit=lhti10 % text italic
\font\preloaded=lhti9
\font\preloaded=lhti8
\font\preloaded=lhti7

\message{more russian fonts,}
\font\preloaded=lhu10 % unslanted text italic

\font\preloaded=lhcsc10 % caps and small caps

\font\preloaded=lhssbx10 % sans serif bold extended

\font\preloaded=lhdunh10 % Dunhill style

\font\preloaded=lhr7 scaled \magstep4 % for titles
\font\preloaded=lhtt10 scaled \magstep2
\font\preloaded=lhssbx10 scaled \magstep2

\let\preloaded=\undefined
\skewchar
}

\input plain

\message{russian codes,}

\def\set#1#2{
\catcode`#1=11
\catcode`#2=11
\uccode`#1=`#1
\uccode`#2=`#1
\lccode`#1=`#2
\lccode`#2=`#2
\sfcode`#1=999
\sfcode`#2=1000
\count255=`#1
\advance\count255 by "7100
\mathcode`#1=\count255
\count255=`#2
\advance\count255 by "7100
\mathcode`#2=\count255
}

\set А а
\set Б б
\set В в
\set Г г
\set Д д
\set Е е
\set Ё ё
\set Ж ж
\set З з
\set И и
\set Й й
\set К к
\set Л л
\set М м
\set Н н
\set О о
\set П п
\set Р р
\set С с
\set Т т
\set У у
\set Ф ф
\set Х х
\set Ц ц
\set Ч ч
\set Ш ш
\set Щ щ
\set Ъ ъ
\set Ы ы
\set Ь ь
\set Э э
\set Ю ю
\set Я я

\let\set=\undefined
\count255=92

\def\fmtname{russian-plain}

\message{russian hyphenation}
