# Fixing problems in latin translitteration of acute accented cyrillic vowels with \directlua

A good translitteration 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 translitteration 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 translitterated 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. Translitteration of acute accented Э́

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

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

It seems\directlua translitteration 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")}
Translitteration by \verb\directlua\ \vspace{\baselineskip}

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

\end{document}


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{