<div dir="ltr">Thanks for this.<br><br>Actually There was a version of the document where Mehdi used hyperref and things looked ok in it. I hope to find that document and send it to you. But I am pretty sure when you compiled this document, you observed lots of warning in your log file. Now let's do a small and simple test with the latest version of bidi that I just released<br>
<br>\documentclass{article}<br>\usepackage{hyperref}<br>\usepackage{bidi}<br>\begin{document}<br>\setRTL<br>This is \href{<a href="http://google.com">http://google.com</a>}{google} and you can use its search engine.<br>\end{document}<br>
<br>after running xelatex you see some warnings in the terminals like:<br><br>** WARNING ** Tried to end an annotation without starting one!<br>** WARNING ** Interpreting special command eann (pdf:) failed.<br>** WARNING ** >> at page="1" position="(402.372, 657.235)" (in PDF)<br>
** WARNING ** >> xxx "pdf:eann"<br>** WARNING ** Unbalanced bann and eann found.<br> )<br><br>and if you look at the PDF file, you see that you have got the wrong result and "this is" is observed as the href instead "google". But this is not a big deal because perhaps you could fix it as follow:<br>
<br>\documentclass{article}<br>\usepackage{hyperref}<br>\usepackage{bidi}<br>\begin{document}<br>\setRTL<br>This is \beginL\href{<a href="http://google.com">http://google.com</a>}{\beginR google\endR}\endL{} and you can use its search engine.<br>
\end{document}<br><br>Now when you run xelatex on it, you see no warning in the terminal and the PDF output look ok. But What about this<br><br>\documentclass{article}<br>\usepackage{hyperref}<br>\usepackage{bidi}<br>\begin{document}<br>
\setRTL<br>This is google and it is a search engine and it is a search engine\beginL\href{<a href="http://google.com">http://google.com</a>}{\beginR google is a search engine\endR}\endL{} and you can use its search engine.<br>
\end{document}<br><br>when you compile it with xelatex, you see no warning in the terminal but you see that in the PDF output, the whole texts is coloured. (This is what I was getting at).<br><br>So yes, we could fix hyperref in bidi partially but unfortunately it is not possible to fix it fully. and in your attached document, you used "linktocpage=true" as one of your options in loading hyperref and that is why your TOC almost look ok. But if you were to not use this option, you would see the unpleasant result. Agaian, yes we can use hyperref with bidi partially but not fully and this partially does not satisfy everyone. So I think we at least need to have some primitives in XeTeX like (\beginspecial and \endspecial) that allows us to fix these issues. The isuue of color is of the same kind. So if \beginspecial and \endspecial is implemented in XeTeX, then we can get hyperref and color to work fully with bidi in XeTeX.<br>
<br><br></div>