4

A good transliteration method from Cyrillic to Latin characters using XeLaTeX is discussed in Using XeTeX for automatic transliteration of Cyrillic letters

Actually I'm using LuaLaTeX. the transliteration can be done by the use of \directlua as suggested by @DavidCarlisle in this post, Create a mapping for transliteration from Cyrillic to Latin in LuaLaTeX, which is actually the root post of this Question.

The present Question discuss the problems of the method suggested by @DavidCarlisle in this post, Create a mapping for transliteration from Cyrillic to Latin in LuaLaTeX, which uses \directlua.

General problems arise from the fact that Unicode system does not provide acute accented vowels, which are formed by the use of the "combining acute accent" character (\char"0301).

1. General accentuation problem

Both XeTeX and LuaTeX print in a wrong manner non transliterated acute accented capital Cyrillic letters, because of a bug in the font I used (Linux Libertine O). This maybe fixed as posted in this Answer: Misplaced Accents in Cyrillic Text, but it forces to modify the text manually replacing, for example, Е́ with '{E}.

2. Transliteration of acute accented Э́

The combination of "combining acute accent" and Ė it seems a hard work to get!

3. The true problem: transliteration of a predefined text string

It seems\directlua transliteration does not apply to a text defined in the preamble.

All of these problems are shown in the following code:

\documentclass{article}
\usepackage{fontspec}

\setmainfont{Linux Libertine O}

\setlength{\parindent}{0pt} \def\textsample{Здравствуй, Мир}

\begin{document}

\textsample \par
Здравствуй, Мир \par
Э э    Э́ э́ \par \vspace{\baselineskip}

\directlua{require("cyrtr2")}
Transliteration by \verb\directlua\ \vspace{\baselineskip} 

\textsample \par
Здравствуй, Мир \par
Э э    Э́ э́ \\    %problems if transliterated with 'Ė ė'

\end{document}

enter image description here

1 Answers1

6

the problem with accents on capital letters is apparently a problem with the libertine font, as noted in your other question.

The transliteration would apply to the preamble if you did

\directlua{require("cyrtr2")}

earlier.

Probably you are looking for

\directlua{luatexbase.remove_from_callback(
"process_input_buffer",
"cyrillic transliteration")

to turn it off as well as

\directlua{
luatexbase.add_to_callback(
"process_input_buffer",
cyrtr,
"cyrillic transliteration")}

to turn it back on (you don't need to input the file with the big mapping each time)

David Carlisle
  • 757,742
  • The suggestion was clear and efficient. Thank you, @DavidCarlisle. As you can understand from my problems, I'm not expert in lua! I actually found another problem with the transliteration method involving acute accented letter 'и' 'i'. I put the Question here: http://tex.stackexchange.com/questions/286112/lualattex-inefficiency-in-transliteration-from-cyrillic-of-acute-accented-vowels – Paolo Polesana Jan 05 '16 at 15:16