\documentclass[12pt]{report} %twoside is for print version
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb,epsf}
\usepackage{latexsym}
\usepackage{graphicx,epsfig}
\usepackage{amssymb,bigints}
\usepackage{float}
\usepackage[font=scriptsize]{caption}
\usepackage{epstopdf}
\usepackage{xcolor,float}
%\usepackage[top=3.2cm,right=0.885in,bottom=2.7cm,left=0.885in,paperwidth=16.5cm,paperheight=23.5cm, headsep=16pt]{geometry}
\usepackage[top=2cm,right=2.5cm,bottom=2cm,left=2cm,paperwidth=16.5cm,paperheight=23.5cm, headsep=16pt]{geometry}

\usepackage{pdfpages}

\usepackage{fancyhdr}
\usepackage{graphicx}
%\usepackage{subfigure}
\usepackage{caption}
\usepackage{subfigure}
\usepackage{textpos}

\pagestyle{fancy}
%####The paper headers settings:
%L --> Left side and R --> Right side	
%O --> Odd pages and E --> Even pages
\newcommand\bls{\renewcommand{\baselinestretch}{0.4}}
\fancyhead[LO]{}
\fancyhead[RO]{\bls $~~$\footnotesize \textbf \fatitle  $~~$ \bls \\}
%\fancyhead[RO]{\bls $~~$\footnotesize \textbf \leftmark $~~$ \bls \\}
\fancyhead[RE]{\bls \footnotesize \textbf{\chaptername~\words{chapter}: \chapps{chapter}} $~~$ \bls \\}
\fancyhead[LE]{\bls $~~~~~~~$\footnotesize \textbf{\faThesis $~~~$%\thepage
	} \bls \\}
\fancyfoot[C]{%\bls $~~$\footnotesize \textbf
	\thepage % $~~$ \bls \\
 }
\renewcommand{\headrulewidth}{1.5pt} %setting header line width. set to 0pt to remove it.
\voffset=-0.3cm	%vertivcal space of header from top of page
%####End of setting for the paper headers

\usepackage{hyperref}
\urlstyle{same}
\usepackage{booktabs}


\usepackage{ifthen}
\renewcommand{\baselinestretch}{1.5}
\hypersetup
{
    colorlinks = false,
    linkbordercolor = {white},
    %linkcolor = {blue},
}
\usepackage{titlesec}
% Allows the use of \toprule, \midrule and \bottomrule in tables for horizontal lines
\usepackage{booktabs}
\usepackage{relsize}%\mathlarger
\usepackage{xepersian}
\renewcommand\bibname{منابع}
\settextfont[Scale=.95]{B Nazanin}
%\settextfont[Scale=1]{XB Zar}
\setlatintextfont[Scale=0.75]{Times New Roman}
\setdigitfont[Scale=0.80]{XB Zar}
\flushbottom

\input{0_MyDeffs}

\makeatletter
%%%%%%%%%%%%%
\renewcommand\listoffigures{%
	\if@twocolumn
	\@restonecoltrue\onecolumn
	\else
	\@restonecolfalse
	\fi
	\newpage
	\centerline{\huge\bfseries\listfigurename}%
	\@mkboth{\MakeUppercase\listfigurename}%
	{\MakeUppercase\listfigurename}%
	\vskip 50\p@
	\@starttoc{lof}%
	\if@restonecol\twocolumn\fi}
%%%%%%%%%%%%%
\renewcommand*\l@chapter[2]
{%
\ifnum \c@tocdepth >\m@ne
	\addpenalty{-\@highpenalty}%
    \vskip 1.0em \@plus\p@
    \setlength\@tempdima{2.4em}%
    \begingroup
      \parindent \z@ \if@RTL\leftskip\else\rightskip\fi \@pnumwidth
      \parfillskip -\@pnumwidth
      \leavevmode \bfseries
      \advance\if@RTL\rightskip\else\leftskip\fi\@tempdima
      \hskip -\if@RTL\rightskip\else\leftskip\fi
      #1\nobreak\leaders\hbox{$\m@th
        \mkern \@dotsep mu\hbox{.}\mkern \@dotsep
        mu$}\hfill \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
      \penalty\@highpenalty
	\endgroup
\fi
}
  
\renewcommand\tableofcontents
{%
\if@twocolumn
	\@restonecoltrue\onecolumn
\else
	\@restonecolfalse
\fi
\centerline{\huge\bfseries\contentsname
\@mkboth{%
\MakeUppercase\contentsname}{\MakeUppercase\contentsname}}%
\vskip 40\p@
\@starttoc{toc}%
\if@restonecol\twocolumn\fi
}
    
\renewcommand{\@starttoc}[1]
{%
\hboxR to \textwidth{\textbf{عنوان} \hfill \textbf{صفحه}} 
\begingroup
\makeatletter
\@input{\jobname.#1}%
\if@filesw
	\expandafter\newwrite\csname tf@#1\endcsname
	\immediate\openout \csname tf@#1\endcsname \jobname.#1\relax
\fi
\@nobreakfalse
\endgroup
}

\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}{2.3em}}
\renewcommand*\l@subsection{\@dottedtocline{2}{5.8em}{3.2em}} 
\makeatother
\makeatletter

\def\@chapter[#1]#2
{
\ifnum \c@secnumdepth >\m@ne
	\if@mainmatter
		\refstepcounter{chapter}%
		\typeout{\@chapapp\space\thechapter.}%
		\addcontentsline{toc}{chapter}
		{\chaptername~\protect\numberline{\@tartibi\c@chapter}~~#1}%
	\else
		\addcontentsline{toc}{chapter}{#1}%
	\fi
\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}{4.3em}{2.3em}}        
\renewcommand*\l@subsection{\@dottedtocline{2}{6.5em}{3.2em}}  
\makeatother

%configuring the format of chapters title
\titleformat{\chapter}[display]
{\normalfont\LARGE\bfseries\centering}
{\chaptername~\words{chapter}}{20pt}{\LARGE}
\titlespacing{\chapter}{2pc}{1.4 cm}{1 cm}[2pc]
%end of configuring the format of chapters title
\include{jeld_info}
\renewcommand{\listfigurename}{فهرست شکل‌ها}
\renewcommand{\listtablename}{فهرست جدول‌ها}
\makeatletter

\def\@makeLTRfnmark{\hbox{\@textsuperscript{\latinfont\@thefnmark}}}
\renewcommand\@makefntext[1]
{%
\parindent 1em%
\noindent
\hb@xt@1.8em{\hss\if@RTL\@makefnmark\else\@makeLTRfnmark\fi}#1
}

\makeatother
