# Accent in Russian above «ы» goes to next line

I am trying to typeset a document in Russian with huge amount of accents, almost in every word. They are typeset by U+0301, «combining acute accent». And I get a problem that in some cases the accent goes to the next line:

\documentclass[twoside]{article}
\usepackage{fontspec}
\usepackage[T2A]{fontenc}
\newfontfamily\cyrillicfont[Mapping=tex-text]{PT Serif}
\usepackage{polyglossia}
\setdefaultlanguage{russian}
\fontsize{10}{12}\selectfont

\hyphenation{ны́-не}

\begin{document}
\parbox{1pt}{Почему́ перено́сы в словах ны́не и мы́ши ухо́дят на сле́дующую стро́чку, а в мя́со брэ́кет слу́хи ворю́га — нет?}
\end{document}


Even the \hyphenation does not help.

Making \'ы also does not help.

Making \mbox{ы́} kills the hyphenation in the word.

How can I fix it without going through the whole text (it's Psalter, by the way) and putting full hyphenation pattern inside the words, like ны́\-не?

• I suspect an issue in the hyphenation patterns; it is not font dependent, because the same happens with Old Standard and Libertinus Serif. – egreg Sep 18 '16 at 13:38
• @egreg How can I fix it? Where to look at, I never worked with the hyphenation patterns. – pantlmn Sep 18 '16 at 14:20
• Not relevant to your problem, but don't load \usepackage[T2A]{fontenc} when using xelatex or lualatex. – Ulrike Fischer Sep 18 '16 at 15:01
• Btw: with luatex the \hyphenation works. – Ulrike Fischer Sep 18 '16 at 15:09
• @pantlmn You might ask at tug.org/mailman/listinfo/tex-hyphen – egreg Sep 18 '16 at 18:06

Thanks to the help from tex-hyphen mailing list, especially from Claudio Beccari, the solution is like this.

The file /usr/local/texlive/2015/texmf-dist/tex/generic/hyph-utf8/patterns/tex/hyph-ru.tex contained the line ы1 which means that any word can have hyphen right after «ы». No other vowel had such a pattern (and thus they did not produce such errors).

So there are two solutions:

1. Add 2^^^^0301 or 4^^^^0301 or 8^^^^0301 into the hyph-ru.tex. It means «forbid hyphenation before combining acute accent». The greater is the number, the stronger is the ban.

2. Remove ы1 from hyph-ru.tex. It means «„ы“ is not a letter after which you can hyphenate in any case, look at other patterns».

After editing you should run fmtutil --all (or fmtutil-sys --all or maybe the option should be --byhyphen ..., I do not really understand it, but fmtutil --all worked for me OK. It shouldn't be sudo fmtutil!).

[Added Jan 25, 2019]: To avoid hyphenation of one letter with accent you can add these lines to hyph-ru.tex:

8^^^^0301
8а^^^^0301.
8е^^^^0301.
8и^^^^0301.
8о^^^^0301.
8у^^^^0301.
8ы^^^^0301.
8э^^^^0301.
8ю^^^^0301.
8я^^^^0301.
.а^^^^03018
.е^^^^03018
.и^^^^03018
.о^^^^03018
.у^^^^03018
.ы^^^^03018
.э^^^^03018
.ю^^^^03018
.я^^^^03018