
\documentclass[a4paper,11pt,oneside,openany]{thesis}
% برای فاصله گذاری استاندارد بین خطوط و دستورات با چند آرگومان اختیاری
\usepackage{amsthm,amssymb,amsmath}
\usepackage{setspace,xargs}
\usepackage [pagebackref=true, colorlinks, linkcolor=blue, citecolor=magenta, urlcolor=cyan] {hyperref}
\usepackage{graphicx,xcolor}
\usepackage [a4paper, bindingoffset=-.5cm, footskip=1cm, headheight = 16pt, top=3cm, bottom=2.5cm,  right=3cm,  left=3cm ,] {geometry}
% ابعاد صفحه و حاشیه‌ها
\usepackage{fancyhdr}
 \usepackage[extrafootnotefeatures]{xepersian}
 \twocolumnfootnotes
\settextfont[Scale=1.1]{XB Zar}
\setdigitfont[Scale=1.1]{Yas}
%================================================settings
\SepMark{-}
\makeatletter 
\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
                         \refstepcounter{chapter}%
                         \typeout{\@chapapp\space\thechapter.}%
                         \addcontentsline{toc}{chapter}%
                                   {\@chapapp~\protect\numberline{\thechapter}#1}%
                    \else
                      \addcontentsline{toc}{chapter}{#1}%
                    \fi
                    \chaptermark{#1}%
                    \addtocontents{lof}{\protect\addvspace{10\p@}}%
                    \addtocontents{lot}{\protect\addvspace{10\p@}}%
                    \if@twocolumn
                      \@topnewpage[\@makechapterhead{#2}]%
                    \else
                      \@makechapterhead{#2}%
                      \@afterheading
                    \fi}
\renewcommand*\l@section{\@dottedtocline{1}{3.5em}{3.3em}}
\renewcommand*\l@subsection{\@dottedtocline{3}{4.8em}{3.2em}} 
\makeatother
% 



\makeatletter
\bidi@patchcmd{\Hy@org@chapter}{%
\addcontentsline{toc}{chapter}%
{\protect\numberline{\thechapter}#1}%
}{%
\addcontentsline{toc}{chapter}%
{\protect\numberline{\chaptername~\tartibi{chapter}}#1}%
}{\typeout{We succeded in redefining \string\@chapter}}
{\typeout{We failed in redefining \string\@chapter}}
\bidi@patchcmd{\l@chapter}{%
\setlength\@tempdima{1.5em}%
 }{%
\setlength\@tempdima{4em}%
}{\typeout{We succeded in redefining \string\l@chapter}}
{\typeout{We failed in redefining \string\l@chapter}}

%%%%%%%%%%%%%%%%%%%
\makeatletter
 \def\abj@num@i#1{%
   \ifcase#1\or الف \or ب\or ج\or د%
            \or ه‍\or و\or ز\or ح\or ط\fi
   \ifnum#1=\z@\abjad@zero\fi}   
 \def\@harfi#1{\ifcase#1\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 م\or ن\or و\or ه\or ی\else\@ctrerr\fi}
 \def\@glsgetgrouptitle#1{\ifcase#1\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 م\or ن\or و\or ه\or ی\else\@ctrerr\fi}
\makeatother
\begin{document}
\begin{spacing}{1.7}
\tableofcontents
\listoffigures
\end{spacing}
%%========================================== Chapters
\pagestyle{fancy}
\XeTeXinterchartokenstate=1
%دستوری برای اینکه کشیدگی در کلمات ایجاد شود
\abovedisplayshortskip=10pt
\belowdisplayshortskip=8pt
\pagenumbering{arabic}\setcounter{page}{1}

\chapter{یکی}
\section{دوتا}
\subsection{سه تا}
\subsubsection{چهارتا}
\chapter{یکی}
\section{دوتا}
\subsection{سه تا}
\subsubsection{چهارتا}
\normalsize
\small
\appendix
\chapter{یکی}
\section{\lr{FPLO2WANNIER}}\label{FPLO2Wann}
\DefaultMathsDigits
%--------------------------------------------------------------------------------------------------
\end{document}

 