<div dir="ltr">Hi<br><br>My main Tex file starts like this:<br><br><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">

<blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">

\input{header.tex}<br>\begin{document}<br>\begin{arab}<br>\begin{center}<br>\Huge \center \titlefont  {poem}<br>\author{me}<br>\end{center}<br>\begin{traditionalpoem}\bodyfont<br>\end{traditionalpoem}<br>\end{arab}<br>\end{document}</blockquote>

</blockquote></blockquote></blockquote></blockquote><div><div><br></div></div><div>when header.tex is:</div><div><br></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">

<blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">\documentclass{article}<br>

\usepackage{fontspec}<br>\usepackage{geometry}<br>\geometry{ hmargin=2.5cm, vmargin=2cm }<br><br>\newfontfamily\titlefont[Script=Arabic]{KacstFarsi}<br>\font\titlefont=&quot;KacstFarsi:script=arab&quot; at 48pt<br>\newfontfamily\bodyfont[Script=Arabic]{Scheherazade}</blockquote>

</blockquote></blockquote><div><div><br></div></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">

<br><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">\usepackage[RTLdocument]{bidi}<br>\usepackage{bidipoem}<br>\usepackage{bidi}<br>\usepackage{xltxtra}<br>\usepackage{polyglossia}<br>

\setdefaultlanguage{english}<br>\setotherlanguage{arabic}<br>\usepackage{arabxetex}<br>\setmainfont{Lucida Grande}<br>\renewcommand\poemcolsepskip{1.5cm}<br><br></blockquote></blockquote></blockquote><div><br></div><div>
But I have this error:</div>
<div>Package bidi Error: Oops! you have loaded package amsmath after bidi package. Please load package amsmath before bidi package, and then try to run xelatex on your document again.</div><div><br></div><div>Any help?</div>

<div><br></div><div><br></div><div>Regards</div></div>