Transliteration from cyrillic to latin characters can be done in LuaLaTeX with the help of directlua
as shown by @DavidCarlisle: Create a mapping for transliteration from cyrillic to latin in LuaLaTeX
This method is a LuaLaTeX alterative to a good XeLaTeX method which exploits Mapping
, as shown by @egreg in his Answer to Using XeTeX for automatic transliteration of cyrillic letters
It has actually at least one bug to be fixed, since, with the same 'TeX Gyre Adventor' font I have to work with, XeLaTeX Mapping
perfectly transliterates acute accented cyrillic vowel 'и́' to 'í', while directlua
separates the acute accent from the letter.
\documentclass{article}
\usepackage{fontspec}
\usepackage{ifluatex,ifxetex}
%Lua does not load cyrillics of 'TeX Gyre Adventor' if loaded as usual \setmainfont{TeX Gyre Adventor}. So I had to bypass this problem with the declarations below:
\newfontfamily{\LuaMainFont}{texgyreadventor-regular.otf}
\newfontfamily{\XeMainFont}{TeX Gyre Adventor}
\newfontfamily{\TranslitFont}[Mapping=cyrillic-to-latin]{TeX Gyre Adventor}%{Linux Libertine O}%
\setlength{\parindent}{0pt}
\def\Accents{И и И́ и́}
\begin{document}
\ifluatex
\LuaMainFont
This is LuaLaTeX \par \vspace{\baselineskip}
Здравствуй, Мир \par
\Accents\ \vspace{\baselineskip}
Translitteration by \verb\directlua\ \vspace{\baselineskip}
\directlua{require("cyrtr2")}
Здравствуй, Мир \par
И и И́ и́ \\ %problems with the 'i' dot
\else
\XeMainFont
This is XeLaTeX \par \vspace{\baselineskip}
Здравствуй, Мир \par
\Accents \par \vspace{\baselineskip}
Translitteration by \verb\Mapping=cyrillic-to-latin\ \vspace{\baselineskip}
\TranslitFont
Здравствуй, Мир \par
\Accents %no problems with the 'i' dot
\fi
\end{document}
NOTE 1: this problem crosses the Question Misplaced Accents in Cyrillic Text, since as it can be seen in the example, acute accent of untransliterated И́ appears misplaced.
NOTE 2: LuaLaTeX loads TeX Gyre Adventor with the entire set of cyrillic fonts if loaded with the file name 'texgyreadventor-regular.otf'. By the contrary, XeLaTeX does not loads TeX Gyre Adventor's cyrillics if not loaded with the simple label 'TeX Gyre Adventor'. This is commented in the code reported above.