Dmitri Pavlov's Plain TeX macros

This page lists some macro packages for TeX that I developed for myself. Please submit your feedback by email if you have any.

All files on this page use the UTF-8 encoding. To use some other encoding, just recode them. For the 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 the file.

Copyright 2007–2023 Dmitri Pavlov. You may redistribute these files under the terms of GNU General Public License version 3.

DPMAC: a single-pass macro package for TeX with LaTeX features.

DPMAC TeX
This macro package implements some commonly used TeX features such as references, bibliography, and table of contents, while only requiring a single run (pass) of TeX, in contrast to LaTeX's archaic multipass system. Integrates the UTF-8 package below.
dpmacs.tex
Same, but without UTF-8.

Unicode Plain TeX with UTF-8 encoding

UTF-8 Plain TeX
This file maps a part of Unicode's code space encoded in UTF-8 into TeX commands. Most of TeX's \chardef/\mathchardef definitions are covered, as well as accented letters from Latin-1. See comments in the file for exceptions. This macro package works with the original unmodified TeX engine. There are modifications of the TeX engine that can process UTF-8 input natively, including some that pass the TRIP test, e.g., the version by Igor Liferenko.

Russian Plain TeX with single-byte encodings

Contents of the package

Russian Plain TeX
This file contains Russian modifications for Plain TeX. The following aspects are covered:
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 https://dmitripavlov.org/tex/lhcodes.mf | 9 tr №¤§„«» ─│┌┐└┘ | iconv -t koi8-r >lhcodes.mf curl https://dmitripavlov.org/tex/plain-ru.tex | iconv -t koi8-r >plain-ru.tex We have to use tr from Plan 9, because 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 file-name 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 format 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 Plain TeX with the UTF-8 encoding

Same as above, but using the UTF-8 encoding instead of single-byte encodings. Hyphenation of both English and Russian words is supported, without using TeX's language mechanism. LH fonts are used by default. All codes, such as lccode, uccode, sfcode are set up properly. Since UTF-8 is a multibyte encoding, it is not possible to use Russian letters in command sequences.

How to install this package

  1. Download plain-ru-utf8.tex.
  2. Create a file called hyphen-ru.tex with Russian hyphenation patterns in the same font encoding as your Cyrillic fonts, which cannot be UTF-8 for the standard TeX. For the LH fonts, the default encoding is CP866. Example (using the ruhyphal.tex hyphenation patterns from the standard TeX distribution): iconv -f koi8-r -t cp866 <$(kpsewhich ruhyphal.tex) >hyphen-ru.tex
  3. Use INITEX to load plain-ru-utf8.tex and perform dump. Example: initex '\input plain-ru \dump'
  4. Place the resulting plain-ru-utf8.fmt file in the appropriate directory.
  5. Now use tex -fmt plain-ru-utf8 file-name 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 format file.

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