\usepackage{amsthm,amssymb,amsmath}
\setlength\paperheight {24.3cm}
\setlength\paperwidth {16.8cm}
\usepackage[top=2.5cm, bottom=2.5cm]{geometry}
%\textheight=24.3cm
%\textwidth=16.8cm
%\usepackage[top=30mm, bottom=30mm]{geometry}
\usepackage{amscd}
\usepackage{graphicx}
\usepackage{framed} 
\usepackage[all]{xy}
\usepackage{lastpage}
\usepackage[pagebackref=false,colorlinks, linkcolor=blue,citecolor=magenta]{hyperref}
\usepackage[pagebackref=false]{hyperref}
\usepackage{fancyhdr}
\usepackage[nottoc]{tocbibind}
\usepackage{makeidx}
\makeindex
\usepackage{xepersian}
\settextfont[Scale=1]{XB Niloofar}
\setlatintextfont[ExternalLocation,BoldFont={lmroman10-bold},BoldItalicFont={lmroman10-bolditalic},ItalicFont={lmroman10-italic}]{lmroman10-regular}
%%%%%%%%%%%%%%%%%%%%%%%%
\setdigitfont[Scale=1.1]{XB Zar}
%%%%%%%%%%%%%%%%%%%%%%%%
\defpersianfont\nabi[Scale=1.5]{Nabi}
\defpersianfont\nastaliq[Scale=2.7]{IranNastaliq}
\defpersianfont\chapternumber[Scale=7]{IranNastaliq}
\defpersianfont\chapterr[Scale=3.5]{IranNastaliq}
\defpersianfont\titr[Scale=1.2]{XB Titre}
\defpersianfont\entezar[Scale=1.5]{EntezareZohoor 1}
%\deflatinfont\script[Scale=1.3]{Kunstler Script}
\deflatinfont\script[Scale=1.5]{Palace Script MT}
%\deflatinfont\times[Scale=1.1]{Times New Roman}
%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand\proofname{\textbf{برهان}}
\renewcommand{\bibname}{کتاب‌نامه}
\newcommand\persiangloss[2]{#1\hfill\lr{#2}\\}
\newcommand\englishgloss[2]{#2\hfill\lr{#1}\\}
%%%%%%%%%%%%%%%%%%%%%%%%
\theoremstyle{defin}
\newtheorem{defin}{تعریف}[section]
\theoremstyle{thm}
\newtheorem{thm}[defin]{قضیّۀ}
\newtheorem{lemma}[defin]{لم}
\newtheorem{prop}[defin]{گزارۀ}
\newtheorem{corollary}[defin]{نتیجۀ}
\newtheorem{note}[defin]{تذکّر}
\theoremstyle{defin}
\newtheorem{example}[defin]{مثال}
%\newtheorem{remark}[definition]{تذکر}
\newtheorem*{solution}{حل}
%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\bb}{\mathbb}
\newcommand{\ca}{\mathcal}
\newcommand{\rd}{\mathrm{d}}
\newcommand{\sh}{\textbf{Sh}}
\newcommand{\per}{\mathrm{PER}}
\newcommand{\mrm}{\mathrm}
\newcommand{\bt}{\begin{theorem}}
\newcommand{\et}{\end{theorem}}
\newcommand{\bpr}{\begin{proposition}}
\newcommand{\epr}{\end{proposition}}
\newcommand{\bl}{\begin{lemma}}
\newcommand{\el}{\end{lemma}}
\newcommand{\bc}{\begin{corollary}}
\newcommand{\ec}{\end{corollary}}
\newcommand{\bp}{\begin{proof}}
\newcommand{\ep}{\end{proof}}
\newcommand{\bd}{\begin{definition}}
\newcommand{\ed}{\end{definition}}
\newcommand{\br}{\begin{note}}
\newcommand{\er}{\end{note}}
\newcommand{\bx}{\begin{example}}
\newcommand{\ex}{\end{example}}
\newcommand{\bs}{\begin{exercise}}
\newcommand{\es}{\end{exercise}}
\newcommand{\ben}{\begin{equation*}}
\newcommand{\een}{\end{equation*}}
\newcommand{\be}{\begin{equation}}
\newcommand{\ee}{\end{equation}}
\newcommand{\bnn}{\begin{eqnarray*}}
\newcommand{\enn}{\end{eqnarray*}}
\newcommand{\bqn}{\begin{eqnarray}}
\newcommand{\eqn}{\end{eqnarray}}
\newcommand{\ba}{\begin{align}}
\newcommand{\ea}{\end{align}}
\newcommand{\bnu}{\begin{enumerate}}
\newcommand{\enu}{\end{enumerate}}
\newcommand{\bso}{\begin{solution}}
\newcommand{\eso}{\end{solution}}
\newcommand{\ft}{\footnote}
\newcommand{\fn}{\LTRfootnote}
\newcommand{\no}{\nonumber}
\DeclareMathOperator{\ke}{Ker}
\DeclareMathOperator{\imag}{Im}
\DeclareMathOperator{\ima}{{\Im}\textrm{m}}
\DeclareMathOperator{\real}{{\Re}\textrm{e}}
\DeclareMathOperator{\spann}{Sp}
\DeclareMathOperator*{\esssup}{ess\,sup}%%  ker ---> Ker :: amsopn.sty
%%%%%%%%%%%%%%%%%%%%%%%
\csname@twosidetrue\endcsname
\pagestyle{fancy}
\fancyhf{} 
\fancyhead[OL]{\thepage}
\fancyhead[ER]{\thepage}
\fancyhead[OR]{\small \leftmark}
\fancyhead[EL]{\small نظریۀ مکمل‌پذیری در مدول‌ها و حلقه‌ها}
\renewcommand{\chaptermark}[1]{%
\markboth{\thechapter.\ #1}{}}
%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\newcommand\mycustomraggedright{%
\if@RTL\raggedleft%
\else\raggedright%
\fi}
\def\@part[#1]#2{%
\ifnum \c@secnumdepth >-2\relax
\refstepcounter{part}%
\addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
\else
\addcontentsline{toc}{part}{#1}%
\fi
\markboth{}{}%
{\centering
\interlinepenalty \@M
\ifnum \c@secnumdepth >-2\relax
\huge\bfseries \partname\nobreakspace\thepart
\par
\vskip 20\p@
\fi
\Huge\bfseries #2\par}%
\@endpart}
\def\@makechapterhead#1{%
\vspace*{50\p@}%
{\parindent \z@ \mycustomraggedright %\@mycustomfont
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter

\nastaliq\bfseries \hspace*{-1cm}{\chapterr\@chapapp}\space {\chapternumber\thechapter}
\par\nobreak
\vskip 20\p@
\fi
\fi
\interlinepenalty\@M 
\huge \bfseries #1\par\nobreak
\vskip 60\p@
}}
\makeatother