# UTF8-based plain TeX

Is there any option among all these LaTeX, XeTeX and so on, that processes input, which is formatted in just the same way, as for Knuth's TeX, but with UTF-8 encoding? I mean, I would like to take a .tex file, which succeeds as input for pdfTeX, insert/replace some contents with Cyrillic text and produce a .pdf, which looks just as well. I haven't found an exact answered question, and I wonder, if things really should be this complicated. LaTeX requires some \usepackage ..., \begin{document}, \end{document}. I don't like being forced to use some macros driven stuff, when the only thing I need is possibility to write in Russian. Even if the old 8-bit engine is still used, why not hide all the crutches, so the user deals with same syntax? Is there any PeaNuTeX, that covers that niche, or, maybe, some command-line option of a well-known, say, LaTeX?

• Your question seems a bit confused: you say about plain, but mention LaTeX too (e.g. in the last sentence). Presumably you want a plain TeX approach? May 10 '19 at 14:51
• Yes. I mean not technically plain, but in terms of syntax. May 10 '19 at 14:53
• I've rolled back an edit: the site structure is such that questions should really be separate from answers. May 10 '19 at 16:31
• Okay then. Just thought it would be most close to what I and others like me wish. I see, you've fixed "don't remember XeTeX syntax right now" issue in your comment below. May 10 '19 at 16:33
• You can always post a self-answer, or suggest an edit to another person's answer/edit (once you have sufficient 'reputation' on the site). May 10 '19 at 16:37

Both XeTeX and LuaTeX are natively-Unicode engines. XeTeX has build-in loading of system fonts; for LuaTeX we need luaotfload. A system font is more-or-less required to get glyph coverage to allow for Unicode Cyrillic. For example, the following uses a common font (Calibri), using a fragment of text from http://masterrussian.com/russian_alphabet.shtml

\ifdefined\directlua
\font\tenrm="[Calibri]:+tlig"
\else
\font\tenrm="[Calibri]:mapping=tex-text;"
\fi
\tenrm
There are 21 consonant letters in Russian: б, в, г, д, ж, з, к, л, м, н, п, р, с, т, ф, х, ц, ч, ш, щ. The consonant letter й is sometimes called a semivowel.

There are 10 vowel letters: а, э, ы, у, о, я, е, ё, ю, и.

Two letters of the Russian alphabets do not designate any sounds. They are the "soft sign" (ь) and the "hard sign" (ъ).
\bye

The LaTeX version of the same requires only a very small addition of code (fontspec, to provide LaTeX interfaces for Unicode font loading):

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Calibri}
\begin{document}
There are 21 consonant letters in Russian: б, в, г, д, ж, з, к, л, м, н, п, р, с, т, ф, х, ц, ч, ш, щ. The consonant letter й is sometimes called a semivowel.

There are 10 vowel letters: а, э, ы, у, о, я, е, ё, ю, и.

Two letters of the Russian alphabets do not designate any sounds. They are the "soft sign" (ь) and the "hard sign" (ъ).
\end{document}
• I've already tried to use xetex, and the resulting document contains blanks in place of where cyrillic text was supposed to appear. May 10 '19 at 15:02
• @Polazhinets.A Did you load a suitable font? Unless you actively select one, xetex will still be using Knuth's Computer Modern in OT1 encoding. May 10 '19 at 15:04
• Oh.. thank you. A single line \font\tenrm="Times New Roman"\tenrm did the trick May 10 '19 at 15:22
• Wait a minute... where has the smart dashes feature gone? I mean -- May 10 '19 at 15:53
• @Polazhinets.A Ligature support is a bit 'interesting', in particular the LuaTeX devs really fell that people should move away from them to real UTF-8 input for these chars. Enabling that would be a separate question ... May 10 '19 at 15:56

In UTF8-based plain TeX you can do: