I would like to have a Cyrillic version of TeX/AMSTeX. I have installed the cyrplain package, but further instructions are too long and technical for me, sometimes referring to README of other packages or suggesting to manually move some files, and the expected result of following them is not quite clear. Citing the README:

To install russian support for Plain TeX, AMS-TeX, Texinfo or BLUe TeX, please do the following steps:

  1. To setup hyphenation, you will need russian hyphenation patterns and a file hyphen.cfg (either from BABEL or created manually). It is recommended to use russian hyphenation patterns contained in the ruhyphen package (see the README in the parent directory for more information). There you will find also documentation on installation and usage of patterns. Note, that for all Plain TeX-based formats it is recommended to use "combined" Russian-English patterns as a single language to avoid necessity to use language switching commands like \Russian and \English (you may use a sample "language.dat" from the ruhyphen package when creating format files).

  2. If you want to be able to use input encodings other than cp866, you should install the T2 package first. Then edit the file cyrtex.cfg, and choose the default input encoding of your documents in the line "\def\definpenc{koi8-r}". In this case you must install BABEL, because we use some files from BABEL (e.g., plain.def, hyphen.cfg).

    Otherwise (if you will process only documents in cp866 encoding), change "\iftrue" to "\iffalse" in cyrtex.cfg (or put cp866 in the definition of \definpenc).

    Note that we use here the file lcydefs.tex which is part of the cyrillic bundle for LaTeX2e (CTAN:macros/latex/required/cyrillic). Note that this file should be generated as explained in 00readme.txt from the cyrillic bundle.

  3. By default, we use LH fonts. You could change this to any other LCY- or T2A-encoded font set (e.g. to use Type1 virtual fonts like 'C1 fonts package'), by redefining the command \fontprefix in cyrtex.cfg.

    We support LCY and T2A font encodings (see cyrtex.cfg). If you use T2A encoding, you should get EXMI fonts from CTAN:macros/ec-plain/*.mf and define \miprefix to ex in cyrtex.cfg.

  4. Edit the file makefmts.sh or makefmts.bat (depending on your platform), and (optionally) remove or comment out the lines which call INITEX for formats which you do not want to install.

Then run the script/batch file makefmts.sh or makefmts.bat. This will create TeX format files: cyrtex.fmt, cyramstex.fmt, cyrtexinfo.fmt and cyrblue.fmt (maybe not all of them if you commented some lines in makefmts script). In case of makefmts.bat, we use short DOSish filenames cyramstx.fmt, cyrtxinf.fmt instead of cyramstex.fmt, cyrtexinfo.fmt. You can rename them to long names if your OS supports them. ;-) Finally, install the format files as usual (maybe creating symlinks or scripts/batch files which call TeX with these formats).

Note: if you are using amsppt with AMS-TeX, you should also patch the file amsppt.sty, changing some hard-coded CM fonts to the corresponding cyrillic fonts. The patch amsppt.diff is in the etc directory of the T2 package [if you do not have a patch utility, you may do the changes manually].

  1. Is there an automated method to activate cyrplain package (creating cyrtex.fmt, cyramstex.fmt, ... in some sensible default configuration)?

  2. Are there some simpler walk-through instructions than this README?

  3. (Soft question.) The activation seems to affect other packages (for example, patching amsppt.sty). How much will the activation of cyrplain affect other parts of the installation? Can this interference be reduced?

In fact, i would not mind any other user friendly solution for being able to compile old sources for russified Plain TeX and AMSTeX, possibly after changing the source encoding. For example, XeTeX looks promising, but i have not yet figured out how to make it use fonts with Cyrillic glyphs. I have created a new question about Cyrillic XeTeX.


It looks like it should be possible to generate cyrplain and cyramsplain formats using fmtutil and that fmtutil already knows about them.

After having patched /usr/local/texlive/2015basic/texmf-dist/tex/plain/cyrplain/plainenc.tex as suggested in a comment to the answer to this question, i tried executing

sudo fmtutil --enablefmt cyrtex
sudo fmtutil --enablefmt cyramstex
sudo fmtutil --missing

and the format files were created in /usr/local/texlive/2015basic/texmf-var/web2c/pdftex/. However, i cannot use them for some reason. For example,

tex &cyrtex

gives the error:

[12] 23093
zsh: command not found: cyrtex
This is TeX, Version 3.14159265 (TeX Live 2015) (preloaded format=tex)
**[12]  + suspended (tty input)  tex

Very strange, what does zsh have to do with it?

  • Yes, encoding can be cp1251. In this case you don't need encTeX and fonts should be replaced like this: xcm... -> wcm...; and hyphenation tables must be recoded accordingly – Igor Liferenko Jun 9 '15 at 1:24
  • @Igor Could you elaborate your last comment as a different answer? I was arriving at roughly the same conclusion, i.e. use win1251 as input codepage and wcm encoded fonts, so that no reencoding was necessary. To make the answer more spicy, could you show how to make such a format with PDFTeX instead? – erreka Jun 9 '15 at 2:05
  • @Lusr56 Ok, write me an email, and explain (preferably in a PDF file) all the details: how you encountered the problem, how you tried to solve it, what resources you've read, how you came to the current conclusion, etc... An example document which you tried to compile will also be useful. Then I will see if I can help you. My email is in the profile. – Igor Liferenko Jun 9 '15 at 2:17
  • @IgorLiferenko The answer is not really for me, but for Alexey, the OP. – erreka Jun 9 '15 at 2:44
  • @Alexey Somehow I have the impression that we didn't actually answer your original question. Do you mind rewriting the question so that the answers actually fit? The point is: there is no easy way to install cyrplain without messing with Plain, LaTeX and Babel at the same time: cyrplain is an adaptation of T2, a LaTeX package, to make it work on Plain; it's rather a kludge anyway. – erreka Jun 9 '15 at 18:34

Forget about cyrplain, use great encTeX package by Petr Olšák.

As an example, here is my format for plain.tex (UTF-8 assumed). After compilation, put the format to search path, for example:

mkdir -p $(kpsewhich --var TEXMFLOCAL)/web2c/tex/
mv lhplain.fmt $(kpsewhich --var TEXMFLOCAL)/web2c/tex/
texhash $(kpsewhich --var TEXMFLOCAL)
  • Where do you get the myplain.ini file? Is that the name of the file you are referring to in the first part of your reply? – erreka Jun 9 '15 at 0:56
  • Yes. Note the "-enc" option. – Igor Liferenko Jun 9 '15 at 1:17
  • Yes, I noticed that; what I also noticed is that the kernel bash script only assumed the existence of plain.tex and ruhyphal.tex, all other files automagically generated. I'll edit the answer with that information. – erreka Jun 9 '15 at 1:38
  • Isn't the lower code packageable into a bash script? That would make the whole process automatic. – erreka Jun 9 '15 at 1:54
  • I prefer to make a simple script, and keep TeX and shell commands in one file (after \dump) to gather everything in one place, like this: perl -ne 'print if /^\\dump$/..eof' myplain.ini|tail -n+2|dash – Igor Liferenko Jun 9 '15 at 2:00

An alternative, still using the cmcyr fonts, and assuming you have a cp1251 encoded text file, would be to make a myplain.ini file with only the following commands:

\input myplain

\def\set #1 #2 {

\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 Я я


\input hyphru

Make sure you save this code in cp1251.

And then run the following commands at the bash prompt, or perform similar actions with your OS:

cp `kpsewhich plain.tex` myplain.tex
perl -i -ne 'BEGIN{open F,"ls -1 /usr/share/texlive/texmf-dist/fonts/tfm/public/cmcyr/wcm*|xargs -i basename {} .tfm|";@a=<F>}next if /\\font\\preloaded/;s!(\\font.*?=)(\w+)!$a=$1;$b=$2;$a.(grep(/^x$b/,@a)?"x":"").$b!e; print' myplain.tex
cat `kpsewhich ruhyphal.tex` | iconv -f koi8-r -t cp1251 > hyphru.tex
tex -jobname tex -ini myplain.ini
mkdir -p /usr/local/share/texmf/web2c/tex/
mv tex.fmt /usr/local/share/texmf/web2c/tex/
rm myplain.tex hyphru.tex tex.log
texhash /usr/local/share/texmf

Notice that now we are calling the wcm fonts, which are cp1251 encoded, instead of the xcm fonts, which are cp866 encoded, in the perl command; and that we don't need the -enc option in the tex call to make the format or the \mubyte-\endmubyte pairs, since there is no reencoding needed. In general, if you can match the input and the font encoding of your document, you only need to setup the fonts and hyphenation patterns and they will work fine.

  • Thanks for the suggestion, but i would need to learn a bit about the internal working of TeXLive distribution before following it. – Alexey Jun 9 '15 at 11:19

Your Answer

