# Misplaced Accents in Cyrillic Text

In educational material for the Russian language and linguistic literature the need to put accents on Cyrillic vowels often arises. However when I tried to do this with luaLaTeX the accents where misplaced.

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{fontspec}
\setmainfont{Linux Libertine:style=Regular}
\begin{document}

Е́сли вы изу́чите

\'{Е}сли вы из\'{у}чите

\'{E}сли вы из\'{y}чите % Here "E" and "y" are Latin glyphs, but this workaround does not
% work with all Cyrillic letters e.g. Я, Ю
\end{document}


The last line would looks nice, but unfortunately these are Latin glyphs.

Is this a problem with the font used (Linux Libertine) or with LaTeX?

• It seems to be a problem with Libertine; another font I tested is OK – egreg Sep 2 '14 at 12:12
• you could report it here: sourceforge.net/p/linuxlibertine/bugs Maybe the following issue is already the same topic: sourceforge.net/p/linuxlibertine/bugs/270 – LaRiFaRi Sep 2 '14 at 12:44
• I made a test with Linux Libertine (above) and Old Standard (below); this is a picture of the result. So I believe it's a bug in the fonts. The test was made with <vowel>+U0301 (combining acute accent). – egreg Sep 2 '14 at 16:30
• I believe you are right, it is a bug in the font. I have now tried to patch the relevant glyphs with FontForge (Element -> Font Info -> Lookups -> GPOS -> 'mark' Top Akzent), and although the changes are applied correctly in the "Metric Window" of FontForge, they are not applied in luaLaTeX. I will have to investigate this tomorrow. – user1512263 Sep 2 '14 at 17:07
• @user1512263 It's the same with XeTeX. – egreg Sep 2 '14 at 17:34

It seems a bug in the fonts: here's the output I get with from the following input (where fixes to the original code are applied):

\documentclass[11pt]{article}
\usepackage{fontspec}
\setmainfont{Linux Libertine O}
\begin{document}

Е́сли вы изу́чите

\'{Е}сли вы из\'{у}чите

\'{E}сли вы из\'{y}чите % Here "E" and "y" are Latin glyphs, but this workaround does not
% work with all Cyrillic letters e.g. Я, Ю
\end{document}


## XeLaTeX

If I change the main font from Linux Libertine O into Old Standard, I get the following (top two lines with Libertine, bottom two lines with Old Standard):

Until the bug is fixed, I can offer you a workaround: the vowels that need a fix look forward to see whether U+0301 follows and, in this case, the acute accent is placed above them with the legacy \accent primitive.

Until the bug is solved (it is not with Libertinus, I'm afraid), I can offer a workaround.

\documentclass[12pt,a5paper,openright,twoside]{memoir}

\usepackage{fontspec}
\usepackage{newunicodechar}

\ExplSyntaxOn
\newunicodechar{А}{\paolo_accent_check:n{А}}
\newunicodechar{Е}{\paolo_accent_check:n{Е}}
\newunicodechar{И}{\paolo_accent_check:n{И}}
\newunicodechar{О}{\paolo_accent_check:n{О}}
\newunicodechar{У}{\paolo_accent_check:n{У}}
\newunicodechar{Ы}{\paolo_accent_check:n{Ы}}
\newunicodechar{Э}{\paolo_accent_check:n{Э}}
\newunicodechar{Ю}{\paolo_accent_check:n{Ю}}
\newunicodechar{Я}{\paolo_accent_check:n{Я}}
\newunicodechar{ы}{\paolo_accent_check:n{ы}}
\newunicodechar{ю}{\paolo_accent_check:n{ю}}

\cs_new_protected:Nn \paolo_accent_check:n
{
\peek_charcode_remove:NTF ^^^^0301
{
\accent"00B4 \scan_stop: #1
}
{ #1 }
}
\ExplSyntaxOff

\def\CyrillicAccents{А а А́ а́ \\ Е е Е́ е́ \\ И и И́ и́ \\ О о О́ о́ \\
У у У́ у́ \\ Ы ы Ы́ ы́ \\ Э э Э́ э́ \\ Ю ю Ю́ ю́ \\ Я я Я́ я́}

\begin{document}

\fontspec{Linux Libertine O}

\parbox[t]{3cm}{\CyrillicAccents}
% disable the new macro
\ExplSyntaxOn \cs_set_eq:NN \paolo_accent_check:n \use:n \ExplSyntaxOff
\parbox[t]{3cm}{\CyrillicAccents}

\end{document}


The left column has the adjusted vowels, the right column the default output.

• The last revision of Libertinus (12 May 2017 Version 6.3) still doesn't take care of the issue. – egreg May 14 '17 at 13:12