# bidi and hyperref change hyphenation

I try to compile th following document. If I load both bidi and hyperref, Mittelbach is not hyphenated. If I comment out one of them, everything is fine. The bstfile is here: http://celxj.org/downloads/unified.bst

\documentclass{scrbook}

\usepackage{natbib}
\bibliographystyle{unified}

\usepackage[hyphens]{url}
\urlstyle{same}

\usepackage{hyperref}

\usepackage{bidi}

\usepackage{filecontents}

\begin{filecontents}{SM.bib}
@book{GMS2013a,
Author = {Frank Mittelbach and Michael Goossens},
Edition = {2},
Title = {The {\LaTeX} Companion},
Year = {2013}}
\end{filecontents}

\begin{document}

Xx There is a huge amount of packages that can be used for various purposes. \citet{GMS2013a} is a good
reference book.

\bibliography{SM}

\end{document}

• natbib doesn't have support for multiple languages; you may be luckier with biblatex. – egreg Nov 1 '13 at 16:21
• I think it is not a natbib problem. The hyphenation works fine if bidi is not loaded. With bidi loaded not even explicit hyphenation with \hypehenation{Mit-tel-bach} is taken into account. If I use \-in the bibtex entry it works. If it was possible to extract the right to left typesetting from the bidi package, I would go for this. This would safe me the trouble with all the modified commands and side effects. – Stefan Müller Nov 1 '13 at 20:00
• The bidi manual says in Section 2.3 that there are problems with hyperref if a link spans more than a line. I guess this is the reason for my problem as well. – Stefan Müller Nov 2 '13 at 6:20
• Would you mind posting a rendering to illustrate why 'Mittelbach' should/should not be hyphenated? – einpoklum Dec 13 '13 at 12:33

UPDATE 2: Peter Breitenlohner said:

The solution is probably a modified definition of 'potentially hyphenatable part' in tex.web ([40] Pre-hyphenation).

\hyphenation{first-word next-word last-word}
\showhyphens{start firstword nextword nextword lastword end}
\bye


This does not seem to be bidi's problem but etex's problem. Try this (without using bidi):

\documentclass{scrbook}

\usepackage{natbib}
\bibliographystyle{unified}

\usepackage[hyphens]{url}
\urlstyle{same}

\usepackage{hyperref}

%\usepackage{bidi}

\TeXXeTstate=1

\usepackage{filecontents}

\begin{filecontents}{SM.bib}
@book{GMS2013a,
Author = {Frank Mittelbach and Michael Goossens},
Edition = {2},
Title = {The {\LaTeX} Companion},
Year = {2013}}
\end{filecontents}

\begin{document}
Xx There is a huge amount of packages that can be used for various purposes. \beginL\citet{GMS2013a}\endL{} is a good
reference book.

\bibliography{SM}

\end{document}


Even a more minimal example:

\documentclass{scrbook}
\TeXXeTstate=1
\begin{document}
Xx There is a huge amount of packages that can be used for various purposes. \beginL Mittelbach \&  Goossens\endL{} is a good
reference book.
\end{document}


Also what you said in the comment about bidi manual and hyperref has nothing to do with this.

UPDATE: I have reported this issue to the author of e-tex; hopefully he has got a fix for this. Well, from my side, there is nothing to do except waiting for his reply.

This issue has been fixed in TeXLive sources. See this commit. So wait for texlive 2014 or build xetex from source.