<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><font face="Menlo" class="">Hi Johann,<span class="Apple-tab-span" style="white-space:pre">                                            </span>18/11/16</font><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class="">I tried with the latest XeLaTeX, using the latest TeXShop and MacTeX distribution under Mac OS El Capitan.</font></div><div class=""><div class=""><font face="Menlo" class="">I put some comments in a file called "</font><span style="color: rgb(4, 51, 255); font-family: Menlo;" class="">[XeTeX] bibi-problem.tex" </span><span style="font-family: Menlo;" class="">derived from your e-mail.</span></div></div><div class=""><span style="font-family: Menlo;" class=""><br class=""></span></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class="">At the beginning, I could not compile, event when replacing the font "Linux Libertine O" (unknown on Mac) by "Times Roman"</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" class="">Then I got strange error messages saying </font><span style="color: rgb(4, 51, 255); font-family: Menlo;" class="">"Missing \begin{document}"</span></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class="">I  then put a "%" at the beginning of each white line (before the line <span style="color: rgb(4, 51, 255); font-family: Menlo;" class="">"</span><span style="color: rgb(4, 51, 255); font-family: Menlo;" class="">\begin{document}")</span></div><div class=""><span style="font-family: Menlo;" class="">TeX still complained: </span><span style="color: rgb(4, 51, 255); font-family: Menlo;" class="">"Missing \begin{document}"</span></div><div class=""><span style="font-family: Menlo;" class="">on the \</span> <span style="font-family: Menlo;" class="">DeclareGraphicsExtensions</span><span style="font-family: Menlo;" class=""> lines below:</span></div><div class=""><span style="font-family: Menlo;" class=""><br class=""></span></div><div class=""><div style="font-family: Menlo;" class=""><font color="#0433ff" class="">\ifpdf</font></div><div style="font-family: Menlo;" class=""><font color="#0433ff" class="">     \DeclareGraphicsExtensions{.png,.pdf,.jpeg,.jpg,.mps} </font></div><div style="font-family: Menlo;" class=""><font color="#0433ff" class="">\else</font></div><div style="font-family: Menlo;" class=""><font color="#0433ff" class="">     \DeclareGraphicsExtensions{.eps,.ps}</font></div><div style="font-family: Menlo;" class=""><font color="#0433ff" class="">\fi</font></div><div style="font-family: Menlo;" class=""><br class=""></div><div style="font-family: Menlo;" class="">until I pushed each of the \DeclareGraphicsExtensions lines to the 1st position:</div><div style="font-family: Menlo;" class=""><br class=""></div><div style="font-family: Menlo;" class=""><div class=""><font color="#0433ff" class="">\ifpdf</font></div><div class=""><font color="#0433ff" class="">%    \DeclareGraphicsExtensions{.png,.pdf,.jpeg,.jpg,.mps} </font></div><div class=""><font color="#0433ff" class="">\DeclareGraphicsExtensions{.png,.pdf,.jpeg,.jpg,.mps} </font></div><div class=""><font color="#0433ff" class="">\else</font></div><div class=""><font color="#0433ff" class="">%     \DeclareGraphicsExtensions{.eps,.ps}</font></div><div class=""><font color="#0433ff" class="">\DeclareGraphicsExtensions{.eps,.ps}</font></div><div class=""><font color="#0433ff" class="">\fi</font></div></div><div style="font-family: Menlo;" class=""><br class=""></div><div style="font-family: Menlo;" class="">Then it compiled, and produced (I hope) what you expected.</div><div style="font-family: Menlo;" class=""><br class=""></div><div style="font-family: Menlo;" class="">Note that I still get an error (but not the same as you) if I enable the bidi package, hence I left the line commented: </div><div style="font-family: Menlo;" class=""><br class=""></div><div class=""><div class=""><font face="Menlo" color="#0433ff" class="">%\usepackage{bidi}<span class="Apple-tab-span" style="white-space: pre;">                       </span>%% with XeLaTeX, </font></div></div><div style="font-family: Menlo;" class=""><br class=""></div><div style="font-family: Menlo;" class=""><br class=""></div><div style="font-family: Menlo;" class="">All in an attached archive.</div><div style="font-family: Menlo;" class=""><br class=""></div><div style="font-family: Menlo;" class="">Maybe you are using some "fragile" constructs (see the problems with white lines), or maybe the packages you use are not all compatible or not all in their last version.</div><div style="font-family: Menlo;" class="">I can't say anything more as this "bidi" package is new to me. </div><div style="font-family: Menlo;" class="">Dick Koch is a specialist and might give some light on this mystery.</div><div style="font-family: Menlo;" class=""><br class=""></div><div style="font-family: Menlo;" class="">Best,</div><div style="font-family: Menlo;" class=""><br class=""></div><div style="font-family: Menlo;" class="">Xan</div><div style="font-family: Menlo;" class=""><br class=""></div><div style="font-family: Menlo;" class=""></div></div></body></html>