6

What would it take to output non-latin letters (e.g. cyrillic letters) to a document using just plain TeX (i.e. without using "third-party" macro packages such as LaTeX)?

4
  • 5
    Are we restricted to Knuth's (8-bit) TeX or can we use other engines?
    – Joseph Wright
    Commented May 24, 2014 at 7:32
  • 2
    Related (/dup): tex.stackexchange.com/questions/163852/…
    – morbusg
    Commented May 24, 2014 at 7:44
  • @JosephWright: currently, I am not very familiar with TeX engines and how they differ, so for me it would be best if you first consider simple, bare-bones engines. Depending on how much I like these solutions, I may or may not ask about other engines, too.
    – SJU
    Commented May 24, 2014 at 9:23
  • 3
    @AngelTsankov Any modern system has pdfTeX, XeTeX and LuaTeX installed: the latter two are UTF-8 engines.
    – Joseph Wright
    Commented May 24, 2014 at 9:29

3 Answers 3

13

Unrecommended way: This is ancient history

This is the oldest approach I've used with some help of Latin transliteration and the AMS fonts, please see pages 15+ in http://mirrors.rit.edu/CTAN/fonts/amsfonts/doc/amsfndoc.pdf. I enclose a snippet for pdftex and a preview of the PDF file.

I was using fonts from the Wadalab project to typeset just several CJK characters. These days I would use xetex, luatex or context with UTF-8 coded input.

% run: tex or pdftex mal-non-latin.tex
\nopagenumbers
\input cyracc.def
\font\tencyr=wncyr10
\def\cyr{\tencyr\cyracc}
\cyr 
Nezna\u\i ka --- literaturny\u\i\  personazh, opisyvayemy\u\i\  kak predstavitel\cprime\ plemeni malen\cprime kikh chelovechkov --- korotyshek, gero\u\i\ posvyashch\"enno\u\i\ ego priklyucheniyam trilogii Nikolaya Nosova i e\"e mnogochislennykh prodolzheni\u\i. Chlen Kluba ves\"elykh chelovechkov.
\par
\font\mjap=dmjhira \mjap
\char"15\char"48\char"06\char"2A\char"49
\bye

mwe

Update: This is one fast test of loading OTF files in the luatex engine.

\nopagenumbers
\input{luaotfload.sty}
\def\mytest{This is a test. Това е тест.\par}
\font\myfont=FreeSerif.otf % a font from the GNU FreeFont family
\myfont\mytest
\font\myfont=LinLibertine_R.otf % a font from the Linux Libertine family
\myfont\mytest
\font\myfont=cmunrm.otf % a font from the Computer Modern family
\myfont\mytest
\bye

mwe, luatex

7
  • 1
    Thanks, it work with Knuth's TeX ('tex mal-non-latin.tex')! A few more questions, though: 1) Why is it unrecommended? 2) You say this is the oldest approach you've used. Is there a newer one?
    – SJU
    Commented May 24, 2014 at 15:00
  • 2
    @Angel If the engine fits you, that's a good news! To 1) We can solve almost anything in TeX, but we are limited when it gets to 8-bit version, e.g. font files can contain only 256 glyphs, there are 16 slots for I/O file operations only, handling calculations need extra care (try to compute factorial of 720)... If you try to solve some of the questions at TeX.SX you will notice you would prefer better tools/engines/packages than the TeX core. To 2) It depends what you are trying to solve, in general xetex+luatex+context are better engines for a usual TeXist and nowadays tasks in typography.
    – Malipivo
    Commented May 24, 2014 at 16:24
  • @Malipivo: OK, I tried LuaTeX on This is a test Това е тест \bye but only got the latin text in the output. Is this a font issue, do I need to input a package or what?
    – SJU
    Commented May 25, 2014 at 7:33
  • @AngelTsankov Please see the update. That example is not handling hyphenation, that would require some additional work.
    – Malipivo
    Commented May 25, 2014 at 8:18
  • @Malipivo: I understand why you define mytest but do you really need to define myfont, as well?
    – SJU
    Commented May 25, 2014 at 8:30
6

You can be inspired by cyrchars.tex file from csplain package.

\input cyrchars

Normal text and текст на русском языке.

{\it Normal text in italics and текст на русском языке}.

{\bf Normal text in bold and текст на русском языке}.

\end

cyrchars

The cyrchars.tex macro uses encTeX for automatically font selection depending on the encoding. The pdfTeX is supposed, the format csplain or pdfcsplain is recommended. You can try the command pdfcsplain document.

2

For Plain TeX there are a series of fonts mapping to different 8bit encoding schemes for cyrillic, in the cmcyr fonts. Just make sure you use the same input and output 8bit encodings (koi8, cp1251, cp866 and iso8859-5 are available). By a similar procedure (setting up fonts in the right encoding) it would be easy to typeset modern Greek. A suitable set of fonts encoded as UNITYPE WINLANGUAGE is distributed in the cm-lgc fonts; adapting them to modern Greek, iso 8859-7 encoded, wouldn't be difficult, simply reencoding the font with afm2tfm.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .