%%
%% This is file `xepersian.sty',

%% 
%%   __________________________________
%%   Copyright © 2008-2010 Vafa Khalighi
%% 
%%   License information appended.
%% 
%% 
\NeedsTeXFormat{LaTeX2e}
\def\xepersianversion{v1.0.4}
\def\xepersianrevision{revision 153}
\def\xepersiandate{2010/03/01}
\ProvidesPackage{xepersian}[\xepersiandate\space \xepersianversion\space <\xepersianrevision>
Persian typesetting in XeLaTeX]
\RequirePackage{fontspec}
\RequirePackage{xepersian-persiancal}
\RequirePackage{xepersian-mathsdigitspec}
\RequirePackage{etoolbox}
\RequirePackage[RTLdocument]{bidi}
\g@addto@macro\document{%
\special{pdf: docinfo <<
/Creator (X∃Persian \xepersianversion\space <\xepersianrevision> Copyright © 2008-2010 Vafa Khalighi)
         >>}}
\edef\xepersianinfo{%
xepersian package (Persian for LaTeX over XeTeX)^^J
Description: The package supports Persian^^J
typesetting, using fonts provided in the distribution.^^J
Copyright © 2008-2010 Vafa Khalighi^^J
\xepersianversion, <\xepersianrevision>, \xepersiandate^^J
License: LaTeX Project Public License, version 1.3c or higher (your choice)^^J
Home: http://xepersian.berlios.de^^J
Location on CTAN: /macros/xetex/latex/xepersian}
\typeout{\xepersianinfo}
\edef\xepersian@everyjob{\the\everyjob}
\everyjob{\xepersian@everyjob\typeout{\xepersianinfo}}
\gdef\@latex@error#1#2{%
   \GenericError{%
      \space\space\space\@spaces\@spaces\@spaces
   }{%
      XePersian Error: #1%
   }{%
      Oops! either you have done something wrong or it is a xepersian bug. Please first produce a similar file without using XePersian package and then compile it with xelatex, if you got the same error, then either you have been certainly doing something wrong or it is a LaTeX bug, otherwise please report the error with a minimal tex file which shows the error to  the Author of XePersian.%
   }{#2}%
}
\gdef\@latexbug{%
  \@latex@error{This may be a XePersian bug}{Please inform the Author of XePersian}}
\AtBeginDocument{\ifdefined\persianfont\relax\else%
\PackageError{xepersian}{Oops! you have not specified any font for the main text of the document. Please specify a font for the main text of the document by using \settextfont\space CS, and then try to run xelatex on your document again}%
\fi}
\AtBeginDocument{\ifdefined\latinfont\relax\else%
\PackageInfo{xepersian}{“You have not specified any font for the Latin texts of the document and so the default TeX fonts will be used for the Latin texts of the document. If you would like to have any other font as the font of the Latin texts, then please specify a font for the Latin texts of the document by using \setlatintextfont\space CS, and then try to run xelatex on your document again”}%
\setlatintextfont[ExternalLocation,BoldFont={lmroman10-bold},BoldItalicFont={lmroman10-bolditalic},ItalicFont={lmroman10-italic},SmallCapsFont={lmromancaps10-regular}]{lmroman10-regular}
\fi}
\AtBeginDocument{\ifdefined\decimalseparator\relax\else%
\PackageInfo{xepersian}{“You have not specified any font for the digits in maths mode and so the digits in maths mode will appear Latin. If you would like to have Persian digits in maths mode, then please specify a font for the digits in maths mode by using \setdigitfont\space CS, and then try to run xelatex on your document again”}%
\fi}
\def\prq{«}
\def\plq{»}
\newfontscript{Persian}{arab}
\newfontlanguage{Persian}{ARA}
\newcommand*\settextfont[2][]{%
\newfontfamily\persianfont[Script=Persian,Mapping=parsidigits,#1]{#2}
\let\rmdefault\zf@family
  \normalfont
}
\newcommand*\settxtmathfont[2][]{%
\newfontfamily\TXTmath[Mapping=txt2maths,#1]{#2}
}
\newcommand*\setlatintextfont[2][]{%
\newfontfamily\latinfont[Mapping=tex-text,#1]{#2}
}
\let\setlatinsansfont\setsansfont
\let\setlatinmonofont\setmonofont
\newcommand*\defpersianfont[1]{%
  \@ifnextchar[{\defpersianfont@i#1}{\defpersianfont@i#1[]}}
\def\defpersianfont@i#1[#2]#3{%
  \zf@fontspec{Script=Persian,Mapping=parsidigits,#2}{#3}%
  \edef\@tempa{%
    \noexpand\DeclareRobustCommand\noexpand#1
      {\noexpand\fontfamily{\zf@family}\noexpand\selectfont}}%
  \@tempa}
\newcommand*\deflatinfont[1]{%
  \@ifnextchar[{\deflatinfont@i#1}{\deflatinfont@i#1[]}}
\def\deflatinfont@i#1[#2]#3{%
  \zf@fontspec{Mapping=tex-text,#2}{#3}%
  \edef\@tempa{%
    \noexpand\DeclareRobustCommand\noexpand#1
      {\noexpand\fontfamily{\zf@family}\noexpand\selectfont}}%
  \@tempa}
\newcommand\persiansfdefault{}
\newcommand\persianttdefault{}
\newcommand\iranicdefault{}
\newcommand\navardefault{}
\newcommand\pookdefault{}
\newcommand\sayehdefault{}
\DeclareRobustCommand\persiansffamily
        {\not@math@alphabet\persiansffamily\mathpersiansf
         \fontfamily\persiansfdefault\selectfont}
\DeclareRobustCommand\persianttfamily
        {\not@math@alphabet\persianttfamily\mathpersiantt
         \fontfamily\persianttdefault\selectfont}
\DeclareRobustCommand\iranicfamily
        {\not@math@alphabet\iranicfamily\mathiranic
         \fontfamily\iranicdefault\selectfont}
\DeclareRobustCommand\navarfamily
        {\not@math@alphabet\navarfamily\mathnavar
         \fontfamily\navardefault\selectfont}
\DeclareRobustCommand\pookfamily
        {\not@math@alphabet\pookfamily\mathpook
         \fontfamily\pookdefault\selectfont}
\DeclareRobustCommand\sayehfamily
        {\not@math@alphabet\sayehfamily\mathsayeh
         \fontfamily\sayehdefault\selectfont}
\DeclareTextFontCommand{\textpersiansf}{\persiansffamily}
\DeclareTextFontCommand{\textpersiantt}{\persianttfamily}
\DeclareTextFontCommand{\textiranic}{\iranicfamily}
\DeclareTextFontCommand{\textnavar}{\navarfamily}
\DeclareTextFontCommand{\textpook}{\pookfamily}
\DeclareTextFontCommand{\textsayeh}{\sayehfamily}
\newcommand*\setpersiansansfont[2][]{%
  \zf@fontspec{Script=Persian,Mapping=parsidigits,#1}{#2}%
  \let\persiansfdefault\zf@family
  \normalfont}
\newcommand*\setpersianmonofont[2][]{%
  \zf@fontspec{Script=Persian,Mapping=parsidigits,#1}{#2}%
  \let\persianttdefault\zf@family
  \normalfont}
\newcommand*\setnavarfont[2][]{%
  \zf@fontspec{Script=Persian,Mapping=parsidigits,#1}{#2}%
  \let\navardefault\zf@family
  \normalfont}
\newcommand*\setpookfont[2][]{%
  \zf@fontspec{Script=Persian,Mapping=parsidigits,#1}{#2}%
  \let\pookdefault\zf@family
  \normalfont}
\newcommand*\setsayehfont[2][]{%
  \zf@fontspec{Script=Persian,Mapping=parsidigits,#1}{#2}%
  \let\sayehdefault\zf@family
  \normalfont}
\newcommand*\setiranicfont[2][]{%
  \zf@fontspec{Script=Persian,Mapping=parsidigits,#1}{#2}%
  \let\iranicdefault\zf@family
  \normalfont}
\def\resetlatinfont{%
\let\normalfont\latinfont%
\latinfont}
\def\setpersianfont{%
\let\normalfont\persianfont%
\persianfont}
\def\lr#1{\begingroup\beginL\latinfont#1\endL\endgroup}
\def\rl#1{\begingroup\beginR\persianfont#1\endR\endgroup}
\def\latin{\bgroup\LatinAlphs\par\@RTLfalse\@Latintrue\@RTL@footnotefalse\resetlatinfont}
\def\endlatin{\par\egroup}
\def\persian{\bgroup\PersianAlphs\par\@RTLtrue\@RTL@footnotetrue\setpersianfont}
\def\endpersian{\par\egroup}
\def\Latin{\if@RTL\par\LatinAlphs\@RTLfalse\@Latintrue\@RTL@footnotefalse\resetlatinfont\fi}
\def\Persian{\if@RTL\relax\else\par\PersianAlphs\@RTLtrue\@Latinfalse\@RTL@footnotetrue\setpersianfont\fi}
\let\originaltoday=\today
\def\today{\lr{\originaltoday}}
\let\latintoday\today
\def\today{\rl{\persiantoday}}
\def\@outputpage{%
\begingroup           % the \endgroup is put in by \aftergroup
  \let \protect \noexpand
  \@resetactivechars
  \global\let\@@if@newlist\if@newlist
  \global\@newlistfalse
  \@parboxrestore
  \shipout \vbox{%
    \set@typeset@protect
    \aftergroup \endgroup
    \aftergroup \set@typeset@protect
                                % correct? or just restore by ending
                                % the group?
  \if@specialpage
    \global\@specialpagefalse\@nameuse{ps@\@specialstyle}%
  \fi
  \if@twoside
    \ifodd\count\z@ \let\@thehead\@oddhead \let\@thefoot\@oddfoot
         \let\@themargin\oddsidemargin
    \else \let\@thehead\@evenhead
       \let\@thefoot\@evenfoot \let\@themargin\evensidemargin
    \fi
    \ifx\@thehead\@empty \let\@thehead\hfil \fi
    \ifx\@thefoot\@empty \let\@thefoot\hfil \fi
    \else %% not @twoside
    \ifx\@oddhead\@empty \let\@thehead\hfil \fi
    \ifx\@oddfoot\@empty \let\@thefoot\hfil \fi
  \fi
  \reset@font
  \normalsize
  \if@RTLmain\setpersianfont\else\resetlatinfont\fi
  \normalsfcodes
  \let\label\@gobble
  \let\index\@gobble
  \let\glossary\@gobble
  \baselineskip\z@skip \lineskip\z@skip \lineskiplimit\z@
    \@begindvi
    \vskip \topmargin
    \moveright\@themargin \vbox {%
      \setbox\@tempboxa \vbox to\headheight{%
        \vfil
        \color@hbox
          \normalcolor
          \hb@xt@\textwidth{\if@RTLmain\beginR\fi\@thehead\if@RTLmain\endR\fi}%
        \color@endbox
        }%                        %% 22 Feb 87
      \dp\@tempboxa \z@
      \box\@tempboxa
      \vskip \headsep
      \box\@outputbox
      \baselineskip \footskip
      \color@hbox
        \normalcolor
        \hb@xt@\textwidth{\if@RTLmain\beginR\fi\@thefoot\if@RTLmain\endR\fi}%
      \color@endbox
      }%
    }%
  \global\let\if@newlist\@@if@newlist
  \global \@colht \textheight
  \stepcounter{page}%
  \let\firstmark\botmark
}
\newcommand\twocolumnstableofcontents{%
\@ifpackageloaded{multicol}{%
  \begin{multicols}{2}[\section*{\contentsname}]%
    \small
    \@starttoc{toc}%
  \end{multicols}}
{\PackageError{xepersian}{Oops! you should load multicol package before xepersian package for being able to use this command.}}}
\def\XePersian{\leavevmode$\smash{\hbox{X\lower.5ex
  \hbox{\kern-.125em\reflect{E}}Persian}}$}
\def\figurename{\if@RTL شکل\else Figure\fi}
\def\tablename{\if@RTL جدول\else Table\fi}
\def\contentsname{\if@RTL فهرست مطالب\else Contents\fi}
\def\listfigurename{\if@RTL فهرست شكل ها\else List of Figures\fi}
\def\listtablename{\if@RTL فهرست جدول ها\else List of Tables\fi}
\def\appendixname{\if@RTL پیوست\else Appendix\fi}
\def\indexname{\if@RTL نمایه\else Index\fi}
\def\refname{\if@RTL مراجع\else References\fi}
\def\abstractname{\if@RTL چکیده\else Abstract\fi}
\def\partname{\if@RTL بخش\else Part\fi}
\def\datename{\if@RTL تاریخ:\else Date:\fi}
\def\@@and{\if@RTL و\else and\fi}
\def\bibname{\if@RTL مراجع\else Bibliography\fi}
\def\chaptername{\if@RTL فصل\else Chapter\fi}
\def\ccname{\if@RTL رونوشت\else cc\fi}
\def\enclname{\if@RTL پیوست\else encl\fi}
\def\pagename{\if@RTL صفحه\else Page\fi}
\def\headtoname{\if@RTL به\else To\fi}
\def\proofname{\if@RTL اثبات\else Proof\fi}
\def\@harfi#1{\ifcase#1\or الف\char"200D\or ب\or ج\or د\or ه\or
و\or ز\or ح\or ط\or ی\or ک\or ل\or م\or ن\or س\or ع\or ف\or ص\or ق\or
ر\or ش\or ت\or ث\or خ\or ذ\or ض\or ظ\or غ\or ی\else\@ctrerr\fi}
\def\harfi#1{\expandafter\@harfi\csname c@#1\endcsname}
\def\@adadi#1{\ifcase#1 \or یک\or دو\or سه\or چهار\or پنج\or شش\or هفت\or هشت\or نه\or ده\or یازده\or دوازده\or سیزده\or چهارده\or پانزده\or شانزده\or هفده\or هجده\or نوزده\or بیست\else\@ctrerr\fi}
\def\adadi#1{\expandafter\@adadi\csname c@#1\endcsname}
\def\@tartibi#1{\ifcase#1 \or اول \or دوم \or سوم \or چهارم \or پنجم \or ششم \or هفتم \or هشتم \or نهم \or دهم \or یازدهم \or دوازدهم \or سیزدهم \or چهاردهم \or پانزدهم \or شانزدهم \or هفدهم \or هجدهم \or نوزدهم \or بیستم\else\@ctrerr\fi}
\def\tartibi#1{\expandafter\@tartibi\csname c@#1\endcsname}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%AAA
\def\SepMark#1{\gdef\@SepMark{\beginR#1\endR}}
\SepMark{-}
\@ifclassloaded{article}{%
\renewcommand*\l@part[2]{%
  \ifnum \c@tocdepth >-2\relax
    \addpenalty\@secpenalty
    \addvspace{2.25em \@plus\p@}%
    \setlength\@tempdima{3em}%
    \begingroup
      \parindent \z@ \if@RTL\leftskip\else\rightskip\fi \@pnumwidth
      \parfillskip -\@pnumwidth
      {\leavevmode
       \large \bfseries #1\hfil \hb@xt@\@pnumwidth{\hss #2}}\par
       \nobreak
       \if@compatibility
         \global\@nobreaktrue
         \everypar{\global\@nobreakfalse\everypar{}}%
      \fi
    \endgroup
  \fi}
\renewcommand\thesubsection   {\thesection\@SepMark\@arabic\c@subsection}
\renewcommand\thesubsubsection{\thesubsection\@SepMark\@arabic\c@subsubsection}
\renewcommand\theparagraph    {\thesubsubsection\@SepMark\@arabic\c@paragraph}
\renewcommand\thesubparagraph {\theparagraph\@SepMark\@arabic\c@subparagraph}
\def\@part[#1]#2{%
    \ifnum \c@secnumdepth >\m@ne
      \refstepcounter{part}%
      \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
    \else
      \addcontentsline{toc}{part}{#1}%
    \fi
    {\parindent \z@ \raggedleft
     \interlinepenalty \@M
     \normalfont
     \ifnum \c@secnumdepth >\m@ne
       \Large\bfseries \partname\nobreakspace\thepart
       \par\nobreak
     \fi
     \huge \bfseries #2%
     \markboth{}{}\par}%
    \nobreak
    \vskip 3ex
    \@afterheading}
    \def\ps@plain{\ps@empty
	\def\@oddfoot{\hfil\thepage\hfil}%
	\let\@evenfoot\@oddfoot
}
\renewenvironment{thebibliography}[1]
     {\section*{\refname}%
      \@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}%
      \list{\@biblabel{\@arabic\c@enumiv}}%
           {\settowidth\labelwidth{\@biblabel{#1}}%
            \rightmargin\labelwidth    \advance\rightmargin\labelsep
            \@openbib@code
            \usecounter{enumiv}%
            \let\p@enumiv\@empty
            \renewcommand\theenumiv{\@arabic\c@enumiv}}%
      \sloppy
      \clubpenalty4000
      \@clubpenalty \clubpenalty
      \widowpenalty4000%
      \sfcode`\.\@m}
     {\def\@noitemerr
       {\@latex@warning{Empty `thebibliography' environment}}%
      \endlist}
\if@twoside
  \def\ps@headings{%
      \let\@oddfoot\@empty\let\@evenfoot\@empty
      \def\@evenhead{\sl\beginR\leftmark\endR\hfil\thepage}%
      \def\@oddhead{\sl\thepage\hfil\beginR\rightmark\endR}%
      \let\@mkboth\markboth
    \def\sectionmark##1{%
      \markboth {\MakeUppercase{%
        \ifnum \c@secnumdepth >\z@
          \thesection\quad
        \fi
        \beginR##1\endR}}{}}%
    \def\subsectionmark##1{%
      \markright {%
        \ifnum \c@secnumdepth >\@ne
          \beginR\thesubsection\quad\endR
        \fi
        \beginR##1\endR}}}
\else
  \def\ps@headings{%
    \let\@oddfoot\@empty
    \def\@oddhead{\sl\thepage\hfil\beginR\rightmark\endR}%
    \let\@mkboth\markboth
    \def\sectionmark##1{%
      \markright {\MakeUppercase{%
        \ifnum \c@secnumdepth >\m@ne
          \beginR\thesection\quad\endR
        \fi
        \beginR##1\endR}}}}
\fi
\def\ps@myheadings{%
    \let\@oddfoot\@empty\let\@evenfoot\@empty
    \def\@evenhead{\sl\thepage\hfil\beginR\leftmark\endR}%
    \def\@oddhead{\sl\beginR\rightmark\endR\hfil\thepage}%
    \let\@mkboth\@gobbletwo
    \let\sectionmark\@gobble
    \let\subsectionmark\@gobble
    }
\pagestyle{plain}
\renewcommand \thepart {\@tartibi\c@part}
\renewcommand\appendix{\par
  \setcounter{section}{0}%
  \setcounter{subsection}{0}%
  \gdef\thesection{\@harfi\c@section}}
}{}



\@ifclassloaded{amsart}{%
\def\@tocline#1#2#3#4#5#6#7{\relax
  \ifnum #1>\c@tocdepth % then omit
  \else
    \par \addpenalty\@secpenalty\addvspace{#2}%
    \begingroup \hyphenpenalty\@M
    \@ifempty{#4}{%
      \@tempdima\csname r@tocindent\number#1\endcsname\relax
    }{%
      \@tempdima#4\relax
    }%
    \parindent\z@ \if@RTL\rightskip\else\leftskip\fi#3\relax \advance\if@RTL\rightskip\else\leftskip\fi\@tempdima\relax
    \if@RTL\leftskip\else\rightskip\fi\@pnumwidth plus4em \parfillskip-\@pnumwidth
    #5\leavevmode\hskip-\@tempdima #6\nobreak\relax
    \hfil\hbox to\@pnumwidth{\@tocpagenum{#7}}\par
    \nobreak
    \endgroup
  \fi}
\renewcommand\thesubsection    {\thesection\@SepMark\arabic{subsection}}
\renewcommand\thesubsubsection {\thesubsection \@SepMark\arabic{subsubsection}}
\renewcommand\theparagraph     {\thesubsubsection\@SepMark\arabic{paragraph}}
\renewcommand\thesubparagraph  {\theparagraph\@SepMark\arabic{subparagraph}}
\def\part{\@startsection{part}{0}%
  \z@{\linespacing\@plus\linespacing}{.5\linespacing}%
  {\normalfont\bfseries\raggedleft}}
\renewenvironment{thebibliography}[1]{%
  \@bibtitlestyle
  \normalfont\bibliofont\labelsep .5em\relax
  \renewcommand\theenumiv{\arabic{enumiv}}\let\p@enumiv\@empty
  \list{\@biblabel{\theenumiv}}{\settowidth\labelwidth{\@biblabel{#1}}%
    \leftmargin\labelwidth \advance\leftmargin\labelsep
    \rightmargin\labelwidth \advance\rightmargin\labelsep
    \usecounter{enumiv}}%
  \sloppy \clubpenalty\@M \widowpenalty\clubpenalty
  \sfcode`\.=\@m
}{%
  \def\@noitemerr{\@latex@warning{Empty `thebibliography' environment}}%
  \endlist
}
\renewcommand \thepart {\@tartibi\c@part}
\renewcommand\appendix{\par
  \setcounter{section}{0}%
  \setcounter{subsection}{0}%
  \gdef\thesection{\@harfi\c@section}}
}{}



\@ifclassloaded{report}{%
\renewcommand*\l@part[2]{%
  \ifnum \c@tocdepth >-2\relax
    \addpenalty{-\@highpenalty}%
    \addvspace{2.25em \@plus\p@}%
    \setlength\@tempdima{3em}%
    \begingroup
      \parindent \z@ \if@RTL\leftskip\else\rightskip\fi \@pnumwidth
      \parfillskip -\@pnumwidth
      {\leavevmode
       \large \bfseries #1\hfil \hb@xt@\@pnumwidth{\hss #2}}\par
       \nobreak
         \global\@nobreaktrue
         \everypar{\global\@nobreakfalse\everypar{}}%
    \endgroup
  \fi}
\renewcommand\theequation
  {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@equation}
\renewcommand \thefigure
     {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@figure}
\renewcommand \thetable
     {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@table}
\renewcommand \thechapter {\@arabic\c@chapter}
\renewcommand \thesection {\thechapter\@SepMark\@arabic\c@section}
\renewcommand\thesubsection   {\thesection\@SepMark\@arabic\c@subsection}
\renewcommand\thesubsubsection{\thesubsection \@SepMark\@arabic\c@subsubsection}
\renewcommand\theparagraph    {\thesubsubsection\@SepMark\@arabic\c@paragraph}
\renewcommand\thesubparagraph {\theparagraph\@SepMark\@arabic\c@subparagraph}
\def\@makechapterhead#1{%
  \vspace*{50\p@}%
  {\parindent \z@ \raggedleft \normalfont
    \ifnum \c@secnumdepth >\m@ne
	\begin{center}
	        \huge\bfseries \@chapapp\space \thechapter
       		 \par\nobreak
        	\vskip 20\p@
	\end{center}
    \fi
    \interlinepenalty\@M
    \begin{center}
	\Huge \bfseries #1\par\nobreak
    \end{center}
    	\vskip 40\p@
  }}
\def\@makeschapterhead#1{%
  \vspace*{50\p@}%
  {\parindent \z@ \raggedleft
    \normalfont
    \interlinepenalty\@M
    \Huge \bfseries  #1\par\nobreak
    \vskip 40\p@
  }}
\renewenvironment{thebibliography}[1]
     {\chapter*{\bibname}%
      \@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}%
      \list{\@biblabel{\@arabic\c@enumiv}}%
           {\settowidth\labelwidth{\@biblabel{#1}}%
            \rightmargin\labelwidth
            \advance\rightmargin\labelsep
            \@openbib@code
            \usecounter{enumiv}%
            \let\p@enumiv\@empty
            \renewcommand\theenumiv{\@arabic\c@enumiv}}%
      \sloppy
      \clubpenalty4000
      \@clubpenalty \clubpenalty
      \widowpenalty4000%
      \sfcode`\.\@m}
     {\def\@noitemerr
       {\@latex@warning{Empty `thebibliography' environment}}%
      \endlist}
\if@twoside
  \def\ps@headings{%
      \let\@oddfoot\@empty\let\@evenfoot\@empty
      \def\@evenhead{\sl\thepage\hfil\beginR\leftmark\endR}%
      \def\@oddhead{\sl\beginR\rightmark\endR\hfil\thepage}%
      \let\@mkboth\markboth
    \def\chaptermark##1{%
      \markboth {\MakeUppercase{%
        \ifnum \c@secnumdepth >\m@ne
            \beginR\@chapapp\ \thechapter. \ \endR%
        \fi
        \beginR##1\endR}}{}}%
    \def\sectionmark##1{%
      \markright {\MakeUppercase{%
        \ifnum \c@secnumdepth >\z@
          \beginR\thesection. \ \endR%
        \fi
        \beginR##1\endR}}}}
\else
  \def\ps@headings{%
    \let\@oddfoot\@empty
    \def\@oddhead{\sl\beginR\rightmark\endR\hfil\thepage}%
    \let\@mkboth\markboth
    \def\chaptermark##1{%
      \markright {\MakeUppercase{%
        \ifnum \c@secnumdepth >\m@ne
            \beginR\@chapapp\ \thechapter. \ \endR%
        \fi
        \beginR##1\endR}}}}
\fi
\def\ps@myheadings{%
    \let\@oddfoot\@empty\let\@evenfoot\@empty
    \def\@evenhead{\sl\thepage\hfil\beginR\leftmark\endR}%
    \def\@oddhead{\sl\beginR\rightmark\endR\hfil\thepage}%
    \let\@mkboth\@gobbletwo
    \let\chaptermark\@gobble
    \let\sectionmark\@gobble
    }
\pagestyle{plain}
\renewcommand \thepart {\@tartibi\c@part}
%to make appendix numbering Persian
\renewcommand\appendix{\par
  \setcounter{chapter}{0}%
  \setcounter{section}{0}%
  \gdef\@chapapp{\appendixname}%
  \gdef\thechapter{\@harfi\c@chapter}
}%end appendix
}{}



\@ifclassloaded{xepersian-thesis}{%
\renewcommand*\l@part[2]{%
  \ifnum \c@tocdepth >-2\relax
    \addpenalty{-\@highpenalty}%
    \addvspace{2.25em \@plus\p@}%
    \setlength\@tempdima{3em}%
    \begingroup
      \parindent \z@ \if@RTL\leftskip\else\rightskip\fi \@pnumwidth
      \parfillskip -\@pnumwidth
      {\leavevmode
       \large \bfseries #1\hfil \hb@xt@\@pnumwidth{\hss #2}}\par
       \nobreak
         \global\@nobreaktrue
         \everypar{\global\@nobreakfalse\everypar{}}%
    \endgroup
  \fi}
\renewcommand\theequation
  {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@equation}
\renewcommand \thefigure
     {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@figure}
\renewcommand \thetable
     {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@table}
\renewcommand \thechapter {\@arabic\c@chapter}
\renewcommand \thesection {\thechapter\@SepMark\@arabic\c@section}
\renewcommand\thesubsection   {\thesection\@SepMark\@arabic\c@subsection}
\renewcommand\thesubsubsection{\thesubsection \@SepMark\@arabic\c@subsubsection}
\renewcommand\theparagraph    {\thesubsubsection\@SepMark\@arabic\c@paragraph}
\renewcommand\thesubparagraph {\theparagraph\@SepMark\@arabic\c@subparagraph}
\def\@makechapterhead#1{%
  \vspace*{50\p@}%
  {\parindent \z@ \raggedleft \normalfont
    \ifnum \c@secnumdepth >\m@ne
        \huge\bfseries \@chapapp\space \thechapter
        \par\nobreak
        \vskip 20\p@
    \fi
    \interlinepenalty\@M
    \Huge \bfseries #1\par\nobreak
    \vskip 40\p@
  }}
\def\@makeschapterhead#1{%
  \vspace*{50\p@}%
  {\parindent \z@ \raggedleft
    \normalfont
    \interlinepenalty\@M
    \Huge \bfseries  #1\par\nobreak
    \vskip 40\p@
  }}
\renewenvironment{thebibliography}[1]
     {\chapter*{\bibname}%
      \@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}%
      \list{\@biblabel{\@arabic\c@enumiv}}%
           {\settowidth\labelwidth{\@biblabel{#1}}%
            \rightmargin\labelwidth
            \advance\rightmargin\labelsep
            \@openbib@code
            \usecounter{enumiv}%
            \let\p@enumiv\@empty
            \renewcommand\theenumiv{\@arabic\c@enumiv}}%
      \sloppy
      \clubpenalty4000
      \@clubpenalty \clubpenalty
      \widowpenalty4000%
      \sfcode`\.\@m}
     {\def\@noitemerr
       {\@latex@warning{Empty `thebibliography' environment}}%
      \endlist}
\if@twoside
  \def\ps@headings{%
      \let\@oddfoot\@empty\let\@evenfoot\@empty
      \def\@evenhead{\sl\thepage\hfil\beginR\leftmark\endR}%
      \def\@oddhead{\sl\beginR\rightmark\endR\hfil\thepage}%
      \let\@mkboth\markboth
    \def\chaptermark##1{%
      \markboth {\MakeUppercase{%
        \ifnum \c@secnumdepth >\m@ne
            \beginR\@chapapp\ \thechapter. \ \endR%
        \fi
        \beginR##1\endR}}{}}%
    \def\sectionmark##1{%
      \markright {\MakeUppercase{%
        \ifnum \c@secnumdepth >\z@
          \beginR\thesection. \ \endR%
        \fi
        \beginR##1\endR}}}}
\else
  \def\ps@headings{%
    \let\@oddfoot\@empty
    \def\@oddhead{\sl\beginR\rightmark\endR\hfil\thepage}%
    \let\@mkboth\markboth
    \def\chaptermark##1{%
      \markright {\MakeUppercase{%
        \ifnum \c@secnumdepth >\m@ne
            \beginR\@chapapp\ \thechapter. \ \endR%
        \fi
        \beginR##1\endR}}}}
\fi
\def\ps@myheadings{%
    \let\@oddfoot\@empty\let\@evenfoot\@empty
    \def\@evenhead{\sl\thepage\hfil\beginR\leftmark\endR}%
    \def\@oddhead{\sl\beginR\rightmark\endR\hfil\thepage}%
    \let\@mkboth\@gobbletwo
    \let\chaptermark\@gobble
    \let\sectionmark\@gobble
    }
\pagestyle{plain}
\renewcommand \thepart {\@tartibi\c@part}
%to make appendix numbering persian
\renewcommand\appendix{\par
  \setcounter{chapter}{0}%
  \setcounter{section}{0}%
  \gdef\@chapapp{\appendixname}%
  \gdef\thechapter{\@harfi\c@chapter}
}%end appendix
}{}



\@ifclassloaded{amsbook}{%
\def\@tocline#1#2#3#4#5#6#7{\relax
  \ifnum #1>\c@tocdepth % then omit
  \else
    \par \addpenalty\@secpenalty\addvspace{#2}%
    \begingroup \hyphenpenalty\@M
    \@ifempty{#4}{%
      \@tempdima\csname r@tocindent\number#1\endcsname\relax
    }{%
      \@tempdima#4\relax
    }%
    \parindent\z@ \if@RTL\rightskip\else\leftskip\fi#3\relax \advance\if@RTL\rightskip\else\leftskip\fi\@tempdima\relax
    \if@RTL\leftskip\else\rightskip\fi\@pnumwidth plus4em \parfillskip-\@pnumwidth
    #5\leavevmode\hskip-\@tempdima #6\nobreak\relax
    \hfil\hbox to\@pnumwidth{\@tocpagenum{#7}}\par
    \nobreak
    \endgroup
  \fi}
\renewcommand\thesubsection    {\thesection\@SepMark\arabic{subsection}}
\renewcommand\thesubsubsection {\thesubsection \@SepMark\arabic{subsubsection}}
\renewcommand\theparagraph     {\thesubsubsection\@SepMark\arabic{paragraph}}
\renewcommand\thesubparagraph  {\theparagraph\@SepMark\arabic{subparagraph}}
\renewenvironment{thebibliography}[1]{%
  \@bibtitlestyle
  \normalfont\bibliofont\labelsep .5em\relax
  \renewcommand\theenumiv{\arabic{enumiv}}\let\p@enumiv\@empty
  \list{\@biblabel{\theenumiv}}{\settowidth\labelwidth{\@biblabel{#1}}%
    \rightmargin\labelwidth \advance\rightmargin\labelsep
     \leftmargin\labelwidth \advance\leftmargin\labelsep
    \usecounter{enumiv}}%
  \sloppy \clubpenalty\@M \widowpenalty\clubpenalty
  \sfcode`\.=\@m
}{%
  \def\@noitemerr{\@latex@warning{Empty `thebibliography' environment}}%
  \endlist
}
\def\frontmatter{\cleardoublepage\pagenumbering{harfi}}
\renewcommand \thepart {\@tartibi\c@part}
%to make appendix numbering persian
\renewcommand\appendix{\par
  \setcounter{chapter}{0}%
  \setcounter{section}{0}%
  \gdef\@chapapp{\appendixname}%
  \gdef\thechapter{\@harfi\c@chapter}
}%end appendix
\def\theindex{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
\columnseprule\z@ \columnsep 35\p@
\@indextitlestyle
\thispagestyle{plain}%
\let\item\@idxitem
\parindent\z@ \parskip\z@\@plus.3\p@\relax
\raggedleft
\hyphenpenalty\@M
\footnotesize}

\def\@idxitem{\par\hangindent -2em}
\def\subitem{\par\hangindent -2em\hspace*{1em}}
\def\subsubitem{\par\hangindent -3em\hspace*{2em}}
}{}



\@ifclassloaded{bookest}{%
\AtBeginDocument{
\def\@makechapterhead#1{%
  \vspace*{20\p@}
  {\parindent \z@ \raggedleft \normalfont
    \ifnum \c@secnumdepth >\m@ne
      \if@mainmatter
        {\colorA\huge\scshape \@chapapp\space \thechapter}
        \par\nobreak
        \vskip 10\p@
      \fi
    \fi
    \interlinepenalty\@M
  {\colorB\hrule}
  \vskip 15\p@
   \begin{flushleft}
     {\colorA\Huge \bfseries #1}\par\nobreak
   \end{flushleft}
  \vskip 5\p@
  {\colorB\hrule}
  \vskip 30\p@
  }}
\def\@makeschapterhead#1{%
  \vspace*{20\p@}
  {\parindent \z@ \raggedright \normalfont
  {\colorB\hrule}
  \vskip 15\p@
   \begin{center}
     {\colorA\Huge \bfseries #1}\par\nobreak
   \end{center}
  \vskip 5\p@
  {\colorB\hrule}
  \vskip 30\p@
  }}
\renewcommand{\setevenhead}[1]{\def\@evenhead{#1}}
\renewcommand{\setoddhead}[1]{\def\@oddhead{#1}}
\renewcommand{\setevenfoot}[1]{\def\@evenfoot{#1}}
\renewcommand{\setoddfoot}[1]{\def\@oddfoot{#1}}
\renewcommand{\oddheadtext}{{\colorA{\slshape\rightmark}\hfill\thepage}}
\renewcommand{\setoddheadtext}[1]{\renewcommand{\oddheadtext}{#1}}
\renewcommand{\evenheadtext}{\oddheadtext}
\renewcommand{\setevenheadtext}[1]{\renewcommand{\evenheadtext}{#1}}
\renewcommand{\evenfoottext}{}
\renewcommand{\setevenfoottext}[1]{\renewcommand{\evenfoottext}{#1}}
\renewcommand{\oddfoottext}{}
\renewcommand{\setoddfoottext}[1]{\renewcommand{\oddfoottext}{#1}}
\renewcommand{\setleftmark}[1]{\renewcommand{\leftmark}{#1}}
\renewcommand{\setrightmark}[1]{\renewcommand{\rightmark}{#1}}
\renewcommand{\makeheadrule}{{\colorB\hrule\@width\textwidth \@height 0.4pt \vskip-0.4pt}}
\renewcommand{\makefootrule}{\makeheadrule}
\if@twoside
  \setevenheadtext{{\colorA\thepage\hfill\slshape\leftmark}}
\fi
\setevenhead{\vbox{\evenheadtext \vskip 5\p@ \makeheadrule}}
\setoddhead{\vbox{\oddheadtext \vskip 5\p@ \makeheadrule}}
\let\UCase\MakeUppercase
\renewcommand{\MakeUppercase}{}
\def\ps@plain{%
    \def\@oddfoot{{\hfil\colorA\thepage\hfil}}
    \def\@evenfoot{{\hfil\colorA\thepage\hfil}}
    \let\@oddhead\@empty
    \let\@evenhead\@empty
}
}
\NoHyper
\renewcommand \thepart {\@tartibi\c@part}
%to make appendix numbering persian
\renewcommand\appendix{\par
  \setcounter{chapter}{0}%
  \setcounter{section}{0}%
  \gdef\@chapapp{\appendixname}%
  \gdef\thechapter{\@harfi\c@chapter}
}%end appendix
}{}


\@ifclassloaded{book}{%
\renewcommand*\l@part[2]{%
  \ifnum \c@tocdepth >-2\relax
    \addpenalty{-\@highpenalty}%
    \addvspace{2.25em \@plus\p@}%
    \setlength\@tempdima{3em}%
    \begingroup
      \parindent \z@ \if@RTL\leftskip\else\rightskip\fi \@pnumwidth
      \parfillskip -\@pnumwidth
      {\leavevmode
       \large \bfseries #1\hfil \hb@xt@\@pnumwidth{\hss #2}}\par
       \nobreak
         \global\@nobreaktrue
         \everypar{\global\@nobreakfalse\everypar{}}%
    \endgroup
  \fi}
\renewcommand\theequation
  {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@equation}
\renewcommand \thefigure
     {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@figure}
\renewcommand \thetable
     {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@table}
\renewcommand \thechapter {\@arabic\c@chapter}
\renewcommand \thesection {\thechapter\@SepMark\@arabic\c@section}
\renewcommand\thesubsection   {\thesection\@SepMark\@arabic\c@subsection}
\renewcommand\thesubsubsection{\thesubsection \@SepMark\@arabic\c@subsubsection}
\renewcommand\theparagraph    {\thesubsubsection\@SepMark\@arabic\c@paragraph}
\renewcommand\thesubparagraph {\theparagraph\@SepMark\@arabic\c@subparagraph}
\def\@makechapterhead#1{%
  \vspace*{50\p@}%
  {\parindent \z@ \raggedleft \normalfont
    \ifnum \c@secnumdepth >\m@ne
      \if@mainmatter
        \huge\bfseries \@chapapp\space \thechapter
        \par\nobreak
        \vskip 20\p@
      \fi
    \fi
    \interlinepenalty\@M
    \Huge \bfseries #1\par\nobreak
    \vskip 40\p@
  }}
\def\@makeschapterhead#1{%
  \vspace*{50\p@}%
  {\parindent \z@ \raggedleft
    \normalfont
    \interlinepenalty\@M
    \Huge \bfseries  #1\par\nobreak
    \vskip 40\p@
  }}
\renewenvironment{thebibliography}[1]
     {\chapter*{\bibname}%
      \@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}%
      \list{\@biblabel{\@arabic\c@enumiv}}%
           {\settowidth\labelwidth{\@biblabel{#1}}%
            \rightmargin\labelwidth
            \advance\rightmargin\labelsep
            \@openbib@code
            \usecounter{enumiv}%
            \let\p@enumiv\@empty
            \renewcommand\theenumiv{\@arabic\c@enumiv}}%
      \sloppy
      \clubpenalty4000
      \@clubpenalty \clubpenalty
      \widowpenalty4000%
      \sfcode`\.\@m}
     {\def\@noitemerr
       {\@latex@warning{Empty `thebibliography' environment}}%
      \endlist}
\renewcommand\frontmatter{%
    \cleardoublepage
  \@mainmatterfalse
  \pagenumbering{harfi}}
\renewcommand\mainmatter{%
    \cleardoublepage
  \@mainmattertrue
  \pagenumbering{arabic}}
\renewcommand\backmatter{%
  \if@openright
    \cleardoublepage
  \else
    \clearpage
  \fi
  \@mainmatterfalse}

\if@twoside
  \def\ps@headings{%
      \let\@oddfoot\@empty\let\@evenfoot\@empty
      \def\@evenhead{\sl\beginR\rightmark\endR\hfil\thepage}%
      \def\@oddhead{\sl\thepage\hfil\beginR\leftmark\endR}%
      \let\@mkboth\markboth
    \def\chaptermark##1{%
      \markboth {\MakeUppercase{%
		 \beginR\@chapapp\ \thechapter.\,\,\endR%
        \ifnum \c@secnumdepth >\m@ne
          \if@mainmatter
          	\beginR##1\endR
          \fi
        \fi
        }}{}}%
    \def\ps@plain{\ps@empty
	\def\@oddfoot{\hfil\thepage\hfil}%
	\let\@evenfoot\@oddfoot
}
    \def\sectionmark##1{%
      \markright {\MakeUppercase{%
		\beginR\thesection\endR\,
        \ifnum \c@secnumdepth >\z@
          \beginR##1\endR \ %
        \fi
        }}}}
\else
  \def\ps@headings{%
    \let\@oddfoot\@empty
    \def\@oddhead{\sl\thepage\hfil\beginR\rightmark\endR}%
    \let\@mkboth\markboth
    \def\chaptermark##1{%
      \markright {\MakeUppercase{%
      	\beginR\@chapapp\ \thechapter. \endR %
        \ifnum \c@secnumdepth >\m@ne
          \if@mainmatter
            \beginR##1\endR
          \fi
        \fi
        }}}}
   
\fi
\pagestyle{headings}


\renewcommand \thepart {\@tartibi\c@part}
%to make appendix numbering Persian
\renewcommand\appendix{\par
  \setcounter{chapter}{0}%
  \setcounter{section}{0}%
  \gdef\@chapapp{\appendixname}%
  \gdef\thechapter{\@harfi\c@chapter}
}%end appendix
\def\@idxitem{\par\hangindent -40\p@}
}{}


\@ifclassloaded{refrep}{%
\renewcommand*\l@part[2]{%
  \ifnum \c@tocdepth >-2\relax
    \addpenalty{-\@highpenalty}%
    \addvspace{2.25em \@plus\p@}%
    \begingroup
      \parindent \z@ \if@RTL\leftskip\else\rightskip\fi \@pnumwidth
      \parfillskip -\@pnumwidth
      {\leavevmode
       \large \bfseries #1\hfil \hbox to\@pnumwidth{\hss #2}}\par
       \nobreak
         \global\@nobreaktrue
         \everypar{\global\@nobreakfalse\everypar{}}%
      \endgroup
  \fi}
\renewcommand\theequation
{\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@equation}
\renewcommand\thefigure
     {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@figure}
\renewcommand\thetable%
     {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@table}
\renewcommand\thesection       {\thechapter\@SepMark\@arabic\c@section}
\renewcommand\thesubsection    {\thesection\@SepMark\@arabic\c@subsection}
\renewcommand\thesubsubsection {\thesubsection \@SepMark\@arabic\c@subsubsection}
\renewcommand\theparagraph     {\thesubsubsection\@SepMark\@arabic\c@paragraph}
\renewcommand\thesubparagraph  {\theparagraph\@SepMark\@arabic\c@subparagraph}
\renewcommand \thepart {\@tartibi\c@part}
%to make appendix numbering Persian
\renewcommand\appendix{\par
  \setcounter{chapter}{0}%
  \setcounter{section}{0}%
  \gdef\@chapapp{\appendixname}%
  \gdef\thechapter{\@harfi\c@chapter}
}%end appendix
}{}

% \renewcommand{\numberwithin}[3][\arabic]{%
%  \@ifundefined{c@#2}{\@nocounterr{#2}}{%
%    \@ifundefined{c@#3}{\@nocnterr{#3}}{%
%      \@addtoreset{#2}{#3}%
%      \@xp\xdef\csname the#2\endcsname{%
%        \@xp\@nx\csname the#3\endcsname \@SepMark\@nx#1{#2}}}}%
% }

\def\@thmcountersep{\@SepMark}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\providecommand*{\xpg@warning}[1]{%
   \PackageWarning{XePersian}%
   {#1}}
\ifcsdef{abjad}{}{%
\def\abjad#1{%
\ifnum#1>1999 \xpg@warning{Illegal value (#1) for abjad numeral} {#1}
\else
  \ifnum#1<\z@\space\xpg@warning{Illegal value (#1) for abjad numeral}%
  \else
    \ifnum#1<10\expandafter\abj@num@i\number#1%
    \else
      \ifnum#1<100\expandafter\abj@num@ii\number#1%
      \else
        \ifnum#1<\@m\expandafter\abj@num@iii\number#1%
        \else
          \ifnum#1<\@M\expandafter\abj@num@iv\number#1%since #1<2000, we must have 1000
          \fi
        \fi
      \fi
    \fi
  \fi
\fi
}
\def\abjad@zero{}
\def\abj@num@i#1{%
  \ifcase#1\or الف\or ب\or ج\or د%
           \or ه\char"200D\or و\or ز\or ح\or ط\fi
  \ifnum#1=\z@\abjad@zero\fi}
\def\abj@num@ii#1{%
  \ifcase#1\or ی\or ک\or ل\or م\or ن%
           \or س\or ع\or ف\or ص\fi
  \ifnum#1=\z@\fi\abj@num@i}
\def\abj@num@iii#1{%
  \ifcase#1\or ق\or ر\or ش\or ت\or ث%
            \or خ\or ذ\or ض\or ظ\fi
  \ifnum#1=\z@\fi\abj@num@ii}
\def\abj@num@iv#1{%
  \ifcase#1\or غ\fi
  \ifnum#1=\z@\fi\abj@num@iii}
}
   \let\@latinalph\@alph%
   \let\@latinAlph\@Alph%
\def\PersianAlphs{%
   \let\@alph\abjad%
   \let\@Alph\abjad%
}
\def\LatinAlphs{%
   \let\@alph\@latinalph%
   \let\@Alph\@latinAlph%
}
\PersianAlphs
\@ifdefinitionfileloaded{loadingorder-bidi}{\input{loadingorder-bidi-xepersian.def}}{}
\@ifpackageloaded{listings}{\input{listings-xepersian.def}}{}
\@ifpackageloaded{algorithmic}{\input{algorithmic-xepersian.def}}{}
\@ifpackageloaded{algorithm}{\input{algorithm-xepersian.def}}{}
\@ifpackageloaded{backref}{\input{backref-xepersian.def}}{}
\@ifpackageloaded{flowfram}{\input{flowfram-xepersian.def}}{}
\@ifpackageloaded{bidi}{\input{footnote-bidi-xepersian.def}}{}
\@ifpackageloaded{bidicode}{\input{bidicode-xepersian.def}}{}
\@ifpackageloaded{breqn}{\input{breqn-xepersian.def}}{}
\@ifpackageloaded{enumerate}{\input{enumerate-xepersian.def}}{}
\@ifpackageloaded{hyperref}{\input{hyperref-xepersian.def}}{}
\@ifpackageloaded{minitoc}{\input{minitoc-xepersian.def}}{}
\@ifpackageloaded{multicol}{\input{multicol-xepersian.def}}{}
\@ifpackageloaded{tocloft}{\@ifclassloaded{memoir}{}{\input{tocloft-xepersian.def}}}{}
\@ifclassloaded{article}{\input{article-xepersian.def}}{}
\@ifclassloaded{amsart}{\input{amsart-xepersian.def}}{}
\@ifclassloaded{report}{\input{report-xepersian.def}}{}
\@ifclassloaded{rapport3}{\input{rapport3-xepersian.def}}{}
\@ifclassloaded{scrartcl}{\input{scrartcl-xepersian.def}}{}
\@ifclassloaded{scrbook}{\input{scrbook-xepersian.def}}{}
\@ifclassloaded{scrreprt}{\input{scrreprt-xepersian.def}}{}
\@ifclassloaded{amsbook}{\input{amsbook-xepersian.def}}{}
\@ifclassloaded{bookest}{\input{bookest-xepersian.def}}{}
\@ifclassloaded{extbook}{\input{extbook-xepersian.def}}{}
\@ifclassloaded{book}{\input{book-xepersian.def}}{}
\@ifclassloaded{refrep}{\input{refrep-xepersian.def}}{}
\@ifclassloaded{memoir}{\input{memoir-xepersian.def}}{}
\DeclareOption{Kashida}{\input{kashida-xepersian.def}}
\DeclareOption{localise}{\input{localise-xepersian.def}}
\ProcessOptions
%% 
%% Copyright © 2008-2010      by Vafa Khalighi     <vafa@users.berlios.de>
%% 
%% Distributable under the LaTeX Project Public License,
%% version 1.3c or higher (your choice). The latest version of
%% this license is at: http://www.latex-project.org/lppl.txt
%% 
%% This work is "maintained" (as per LPPL maintenance status)
%% by Vafa Khalighi.
%% 
%% 
%% 
%% 
%%
%% End of file `xepersian.sty'.
