3

Is it possible to make \lefthypenmin and \righthypenmin ignore accents and not count them as separate letters?

\documentclass{article}
\usepackage{fontspec}
\usepackage{polyglossia}
\setdefaultlanguage{russian}
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}}
\setmainfont[Ligatures=TeX]{PT Serif}
\newfontfamily\cyrillicfont[Ligatures=TeX]{PT Serif}

\begin{document}
\righthyphenmin=2
\parbox[t]{1pt}{\hspace{0pt}неистовое}\hspace{3cm}
\parbox[t]{1pt}{\hspace{0pt}неистовое́}
\end{document}

I mean that the words should be hyphenated the same way, but not like this:

different hyphenation when accent added

I used luaLaTeX for this. XeLaTeX give the same result.

Or maybe there is a solution for less general case: disallow TeX hyphenate before one accented letter in the end of the word.

Update:

There is a solution of the less general case for XeLaTeX: editing hyph-ru.tex and adding these lines and running fmtutil --all helps:

8^^^^0301
8а^^^^0301.
8е^^^^0301.
8и^^^^0301.
8о^^^^0301.
8у^^^^0301.
8ы^^^^0301.
8э^^^^0301.
8ю^^^^0301.
8я^^^^0301.
6
  • As far as TeX is concerned, the accented letter counts for two, because it is realized as the vowel followed by a combining character. Extensive changes to the source would be needed to make it count as one.
    – egreg
    Aug 2, 2017 at 8:18
  • You will likely have to create, in the preamble, a list of hyphenation exceptions of the form \hyphenation{неисто-вое́}. Hopefully, your document doesn't contain lots and lots of distinct words that end in accented characters.
    – Mico
    Aug 2, 2017 at 9:00
  • In context it works by setting the \hjcode of the combining char to 2, but I couldn't get to work it yet in lualatex. I will have to try with a development luatex. Aug 2, 2017 at 9:33
  • @egreg maybe it is possible to write code in Lua (I am a newbie in it) that will check the beginning of the lines for such combination and at least highlight it (or warn in terminal output)?
    – pantlmn
    Aug 2, 2017 at 10:11
  • @Mico I work with some documents where all words are accented :-(
    – pantlmn
    Aug 2, 2017 at 10:12

1 Answer 1

3

The documentation of luatex is imho in this part quite incomprehensible so it took me a while to realize that one needs to set \savinghyphcodes=1 to be able to change \hjcode. This here seems to work but I don't really understand it, most if it is guessed:

\documentclass{article}
\usepackage{fontspec}
\savinghyphcodes=1
\usepackage{polyglossia}
\setdefaultlanguage{russian}

\setmainfont[Ligatures=TeX]{PT Serif}
\textwidth=1pt
\begin{document}

\righthyphenmin=2

blb неистовое

неистовое́

\hjcode`\^^^^0301=32 %32=zero length

неистовое́

\end{document}

enter image description here

2
  • LuaTeX, Version 0.95.0 (TeX Live 2016) makes no difference in last lines: неистово-е. Probably I should update.
    – pantlmn
    Aug 2, 2017 at 10:50
  • 1
    Yes. This is rather new. I tested it with texlive 2017. Aug 2, 2017 at 10:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .