\documentclass[12pt,oneside]{memoir}
%----------------------------------------------------------------
\usepackage{amsmath,amsthm,amssymb,amsfonts,amscd}
\usepackage{makeidx}
\usepackage{graphicx}
\usepackage{bussproofs}
\usepackage{float}
\usepackage{perpage}


\usepackage[a4paper,vmargin=3.5cm,left=3cm,right=4cm]{geometry}
\MakePerPage{footnote}

%----------------------------------------------------------------
\makeatletter
\@ifundefined{Umathcode}{\let\Umathcode\XeTeXmathcode}{}
\@ifundefined{Umathchardef}{\let\Umathchardef\XeTeXmathchardef}{}
\renewcommand{\@makefntext}[1]{\parindent 1em%
   \noindent\hbox to 1em{}% if you want to indent footnote text you can change the width of the hbox (e.g. \hbox to 2em{})
\llap{\if@RTL\else\latinfont\fi\@thefnmark.\space}#1}
\makeatother

%\usepackage{fancyhdr}
%\pagestyle{fancy}
%\usepackage{tocbibind}
%\usepackage{fancybox}
%----------------------------------------------------------------

\usepackage{xepersian}
\usepackage[extrafootnotefeatures]{xepersian} 
\twocolumnfootnotes 
%\threecolumnfootnotes

\settextfont[Scale=1]{XB Niloofar}
\setdigitfont[Scale=1]{XB Zar}
\setlatintextfont[Scale=1]{Times New Roman}
\defpersianfont\Nastaliq[Scale=1.2]{IranNastaliq}
\defpersianfont\Titre[Scale=1]{XB Titre}


%------------------------------------------------------------
%\makeatletter
%\@addtoreset{footnote}{page}
%\makeatother

%----------------------------------------------------------------
\theoremstyle{plain}
\newtheorem{thm}{قضیه}%[section]
\numberwithin{thm}{section}
\renewcommand{\thethm}{\arabic{thm}.\arabic{section}.\arabic{chapter}}
\newtheorem{lem}[thm]{لم}
\newtheorem{prop}[thm]{گزاره}
\newtheorem{cor}[thm]{نتیجه}
\theoremstyle{definition}
\newtheorem{dfn}[thm]{تعریف}
\newtheorem{exam}[thm]{مثال}
\newtheorem{rem}[thm]{ملاحظه}
%----------------------------------------------------------------
\renewcommand{\listfigurename}{فهرست شکل‌ها}
\renewcommand{\listtablename}{فهرست جدول‌ها}
\renewcommand{\bibname}{مراجع}
%
\newcommand{\Tableofcontents}{%
\clearpage\addtolength{\baselineskip}{0ex}
\tableofcontents
\clearpage\addtolength{\baselineskip}{0ex}}
%
\newcommand{\Listoffigures}{%
\clearpage\addtolength{\baselineskip}{0ex}
\listoffigures
\clearpage\addtolength{\baselineskip}{0ex}}
%
\newcommand{\Listoftables}{%
\clearpage\addtolength{\baselineskip}{0ex}
\listoftables
\clearpage\addtolength{\baselineskip}{0ex}}
%
\newcommand{\Listofsymbols}{%
\clearpage
\begin{persian}
\input{files/symbols}
\end{persian}	
\clearpage}
%
%--------------------------------------------------------------------------------
%
\makechapterstyle{duchapstyle}{%
  \chapterstyle{default}
  \renewcommand*{\printchaptername}{\centering\huge\bfseries\chaptername}
    \renewcommand*{\chaptitlefont}{\normalfont\huge\Titre}
  \renewcommand*{\printchaptertitle}[1]{%
    \vskip\onelineskip\centering\chaptitlefont ##1}
  \renewcommand*{\afterchaptertitle}{%
    \vskip\onelineskip\vskip\afterchapskip}
  \setlength{\beforechapskip}{3\baselineskip}
  \renewcommand*{\printchapternonum}{%
    \vphantom{\chapnumfont One}
    \afterchapternum%
    \vskip\topskip}
  \setlength{\beforechapskip}{2\onelineskip}}
\chapterstyle{duchapstyle}
%
%------------------------------------------------------------------------------------
%
\numberwithin{figure}{chapter}
\numberwithin{table}{chapter}
\numberwithin{equation}{chapter}
%
\setcounter{secnumdepth}{2}
\renewcommand{\thesection}{\arabic{section}-\arabic{chapter}}
\renewcommand{\thesubsection}{\arabic{subsection}-\arabic{section}-\arabic{chapter}}
%
\renewcommand{\thefigure}{\arabic{figure}-\arabic{chapter}}
\renewcommand{\thetable}{\arabic{table}-\arabic{chapter}}
%
\renewcommand{\baselinestretch}{1.5}
%
\newlength{\linespace}
\linespace=.7ex
\newlength{\SKIP}
\SKIP=1ex
\newlength{\SKIPP}
\SKIPP=2ex
\newlength{\SKIPPP}
\SKIPPP=3ex
%
%--------------------------------------------------------------------------------------------------
%
\def\By{توسط:}
\def\latinBy{By:}
%
%--------------------------------------------------------------------------------------------------
\newcommand{\faculty}{}
\newcommand{\Faculty}[1]{\renewcommand{\faculty}{#1}}
%
\newcommand{\latinfaculty}{}
\newcommand{\LatinFaculty}[1]{\renewcommand{\latinfaculty}{#1}}
%
\newcommand{\subject}{}
\newcommand{\Subject}[1]{\renewcommand{\subject}{#1}}
%
\newcommand{\latinsubject}{}
\newcommand{\LatinSubject}[1]{\renewcommand{\latinsubject}{#1}}
%
\newcommand{\field}{}
\newcommand{\Field}[1]{\renewcommand{\field}{#1}}
%
\newcommand{\latinfield}{}
\newcommand{\LatinField}[1]{\renewcommand{\latinfield}{#1}}
%
\newcommand{\thesistitle}{}
\newcommand{\ThesisTitle}[1]{\renewcommand{\thesistitle}{#1}}
%
\newcommand{\latinthesistitle}{}
\newcommand{\LatinThesisTitle}[1]{\renewcommand{\latinthesistitle}{#1}}
%
\newcommand{\stname}{}
\newcommand{\StudentName}[1]{\renewcommand{\stname}{#1}}
%
\newcommand{\latinstname}{}
\newcommand{\LatinStudentName}[1]{\renewcommand{\latinstname}{#1}}
%
\newcommand{\supervisor}{استاد راهنما:}
%
\newcommand{\supname}{}
\newcommand{\SupervisorName}[1]{\renewcommand{\supname}{#1}}
%
\newcommand{\secsupname}{}
\newcommand{\SecondSupervisorName}[1]{%
\renewcommand{\supervisor}{استادان راهنما:}
\renewcommand{\secsupname}{#1}}
%
\newcommand{\latinsupervisor}{Supervisor:}
%
\newcommand{\latinsupname}{}
\newcommand{\LatinSupervisorName}[1]{\renewcommand{\latinsupname}{#1}}
%
\newcommand{\latinsecsupname}{}
\newcommand{\LatinSecondSupervisorName}[1]{%
\renewcommand{\latinsupervisor}{Supervisors:}
\renewcommand{\latinsecsupname}{#1}}
%
\newcommand{\advisor}{استاد مشاور:}
%
\newcommand{\advname}{}
\newcommand{\AdvisorName}[1]{\renewcommand{\advname}{#1}}
%
\newcommand{\secadvname}{}
\newcommand{\SecondAdvisorName}[1]{%
\renewcommand{\advisor}{استادان مشاور:}
\renewcommand{\secadvname}{#1}}
%
\newcommand{\latinadvisor}{Advisor:}
%
\newcommand{\latinadvname}{}
\newcommand{\LatinAdvisorName}[1]{\renewcommand{\latinadvname}{#1}}
%
\newcommand{\latinsecadvname}{}
\newcommand{\LatinSecondAdvisorName}[1]{%
\renewcommand{\latinadvisor}{Advisors:}
\renewcommand{\latinsecadvname}{#1}}
%
\newcommand{\thesisdate}{}
\newcommand{\ThesisDate}[1]{\renewcommand{\thesisdate}{#1}}
%
\newcommand{\latinthesisdate}{}
\newcommand{\LatinThesisDate}[1]{\renewcommand{\latinthesisdate}{#1}}
%
%-------------------------------------------------------------------------------------------------------------
%
\newcommand{\DOTS}{}
%
\newcommand{\pdegree}{}
\newcommand{\Degree}[1]{\renewcommand{\pdegree}{\textbf{#1}}}
%
\newcommand{\ldegree}{}
\newcommand{\LatinDegree}[1]{\renewcommand{\ldegree}{\textbf{#1}}}
%
\newcommand{\tcmi}{}
\newcommand{\ThesisCommitteeMemberOne}[1]{\renewcommand{\tcmi}{\DOTS #1}}
%
\newcommand{\ltcmi}{}
\newcommand{\LatinThesisCommitteeMemberOne}[1]{\renewcommand{\ltcmi}{\DOTS #1}}
%
\newcommand{\tcmii}{}
\newcommand{\ThesisCommitteeMemberTwo}[1]{\renewcommand{\tcmii}{\DOTS #1}}
%
\newcommand{\ltcmii}{}
\newcommand{\LatinThesisCommitteeMemberTwo}[1]{\renewcommand{\ltcmii}{\DOTS #1}}
%
\newcommand{\tcmiii}{}
\newcommand{\ThesisCommitteeMemberThree}[1]{\renewcommand{\tcmiii}{\DOTS #1}}
%
\newcommand{\ltcmiii}{}
\newcommand{\LatinThesisCommitteeMemberThree}[1]{\renewcommand{\ltcmiii}{\DOTS #1}}
%
\newcommand{\tcmiv}{}
\newcommand{\ThesisCommitteeMemberFour}[1]{\renewcommand{\tcmiv}{\DOTS #1}}
%
\newcommand{\ltcmiv}{}
\newcommand{\LatinThesisCommitteeMemberFour}[1]{\renewcommand{\ltcmiv}{\DOTS #1}}
%
\newcommand{\tcmv}{}
\newcommand{\ThesisCommitteeMemberFive}[1]{\renewcommand{\tcmv}{\DOTS #1}}
%
\newcommand{\ltcmv}{}
\newcommand{\LatinThesisCommitteeMemberFive}[1]{\renewcommand{\ltcmv}{\DOTS #1}}
%
\newcommand{\tcmvi}{}
\newcommand{\ThesisCommitteeMemberSix}[1]{\renewcommand{\tcmvi}{\DOTS #1}}
%
\newcommand{\ltcmvi}{}
\newcommand{\LatinThesisCommitteeMemberSix}[1]{\renewcommand{\ltcmvi}{\DOTS #1}}
%
\newcommand{\tcmvii}{}
\newcommand{\ThesisCommitteeMemberSeven}[1]{\renewcommand{\tcmvii}{\DOTS #1}}
%
\newcommand{\ltcmvii}{}
\newcommand{\LatinThesisCommitteeMemberSeven}[1]{\renewcommand{\ltcmvii}{\DOTS #1}}
%-------------------------------------------------------------------------------------------------------------
%
\def\University{دانشگاه دامغان}
\def\LatinUniversity{Damghan University}
\def\Ministry{وزارت علوم، تحقیقات و فناوری}
\def\LatinMinistry{Ministry of Science, Research, and Technology}
\def\MsThesis{پایان‌نامه کارشناسی ارشد}
\def\LatinMsThesis{M.Sc. Thesis}
%
%-------------------------------------------------------------------------------------------------------------
%
\def\InTheNameofGodPage{
\clearpage\newpage
\thispagestyle{empty}
\vspace*{\stretch{1}}
\begin{center}
\def\InTheNameofGod{بسم اللّه الرحمن الرحیم}
\Huge\Nastaliq
\InTheNameofGod
\end{center}
\vspace*{\stretch{3}}
\clearpage}
%
%-------------------------------------------------------------------------------------------------------------
\def\MakeTitlePage{%
\newpage
\thispagestyle{empty}
\begin{center}
{\large\Titre\Ministry}
\par
%
%\vspace*{\linespace}
%
\includegraphics[height=3.5cm]{style/logo}
\par
%
%\vspace*{\linespace}
%
{\large\Titre\University}
\par
%
%\vspace*{\linespace}
%
{\large\Titre\faculty}
\par
%
\vspace*{\fill}
%
{\LARGE\MsThesis}
\par
%
\vspace*{\SKIP}
%
{\LARGE\subject~(گرایش~\field)}
\par
%
\vspace*{\fill}
%
\begin{quote}
\huge\Titre
%\addtolength{\baselineskip}{\linespace}
\begin{center} \thesistitle \end{center}
\end{quote}
%
\vspace*{\fill}
%
{\Large\By}
\par
%
\vspace*{\linespace}
%
{\large\Titre\stname}
\par
%
\vspace*{\fill}
%
{\Large\supervisor}
\par
\vspace*{\linespace}
%
{\large\Titre\supname}
\par
\vspace*{\linespace}
{\large\Titre\secsupname}
\par
%
\vspace*{\fill}
%
{\Large\advisor}
\par
\vspace*{\linespace}
%
{\large\Titre\advname}
\par
\vspace*{\linespace}
{\large\Titre\secadvname}
\par
%
\vspace*{\fill}
%
{\thesisdate}
\end{center}
\vspace*{5mm}
%
\clearpage\newpage
\thispagestyle{empty}
\vspace*{\stretch{1}}
\begin{center}
\includegraphics[width=10cm]{style/god}
\end{center}
\vspace*{\stretch{3}}
\clearpage
}
%
%-------------------------------------------------------------------------------------------------------------
%
\def\MakeEvaluationPage{%
\clearpage\newpage
\thispagestyle{empty}
%
\centerline{\large\Titre به نام خدا}
%
\par
\vspace*{\fill}
%
\begin{quote}
\centering\LARGE\Titre
    %\addtolength{\baselineskip}{.5\linespace}
    \thesistitle
\end{quote}
%
\vspace*{\fill}
%
\centerline{\Large\bfseries\By}
\par
%
\vspace*{\linespace}
%
\centerline{\Large\stname}
%
\vspace*{\fill}
%
\def\THESIS{پایان‌نامه}
\centerline{\bfseries\Large\THESIS}
\par
%
\begin{quote}
\centering
%\addtolength{\baselineskip}{.5\linespace}
ارائه شده به تحصیلات تکمیلی دانشگاه به عنوان بخشی از فعالیت‌های تحصیلی لازم برای
اخذ درجه کارشناسی ارشد
\end{quote}
%
\vspace*{\fill}
%
\def\In{در رشته}
\centerline{\bfseries\Large\In}
\par
%
\vspace*{\SKIP}
%
\centerline{\Large\subject~(گرایش~\field)}
\par
\vspace*{\SKIPP}
%
\def\From{از دانشگاه دامغان}
\centerline{\Large\From}
%
\par
\vspace*{\fill}
{
\noindent
ارزیابی و تأیید شده توسط کمیته پایان‌نامه  با درجه:
\pdegree
}
%
\par
%
{\renewcommand{\labelitemi}{}
\begin{itemize}
\small
\item \tcmi
\item \tcmii
\item \tcmiii
\item \tcmiv
\item \tcmv
\item \tcmvi
\item \tcmvii
\end{itemize}
}
%
\vspace*{\fill}
\centerline{\thesisdate}
}
%
%--------------------------------------------------------------------------------------------------
%
\def\DedicationName{تقدیم به}
\newenvironment{Dedication}%
{\clearpage\thispagestyle{empty}
\par
%
\vspace*{3\baselineskip}
%
\begin{center}
\huge\Nastaliq\DedicationName
\end{center}
\vspace*{5ex}
\begin{quote}
}
{\end{quote}\newpage}
%
%-------------------------------------------------------------------------------------------------------------
%
\def\ThanksName{سپاسگزاری}
\newenvironment{Thanks}%
{\clearpage \thispagestyle{empty}
\par \vspace*{3\baselineskip}
\begin{center}
\huge\Nastaliq \ThanksName
\end{center}
\vspace*{5ex}
\begin{quote}
}
{\end{quote}}
%
%-------------------------------------------------------------------------------------------------------------
%
\def\AbstractName{چکیده}
\newenvironment{AbstractPage}%
{\clearpage\newpage
\pagenumbering{alph}
\setcounter{page}{4}
%
\vspace*{5ex}
%
\begin{center} \Large\AbstractName \end{center}
%
\vspace*{5ex}
%
\begin{quote}
\LARGE\Titre %\addtolength{\baselineskip}{.5\linespace}
\begin{center} \thesistitle \end{center}
\end{quote}
%
\vspace*{4ex}
%
\begin{center}
\def\BY{به وسیله‌ی:}
{\Large\BY}
\par
\vspace*{\SKIP}
{\Large\stname}
\end{center}
\vspace*{5ex}
\small}{\normalfont\normalsize\newpage}
%
%-----------------------------------------------------------------------------------------------------------------
%
\def\MakeLatinTitlePage{%
\clearpage\newpage
\begin{latin}
\thispagestyle{empty}
%
\begin{center}
{\large\bfseries\LatinMinistry}
\par
%
\includegraphics[height=3.5cm]{style/logo}
\par
%
{\large\bfseries\LatinUniversity}
\par
%\vspace*{-\linespace}
%
{\large\bfseries\latinfaculty}
\par
%
\vspace*{\fill}
%
{\Large\bfseries\LatinMsThesis}
\par
%
\vspace*{\linespace}
%
{\LARGE In~\latinsubject~(\latinfield)} \par
%
\vspace*{\fill}
%
\begin{quote}
\Huge\bfseries\addtolength{\baselineskip}{-\linespace}
\begin{center} \latinthesistitle \end{center}
\end{quote}
%
\vspace*{\fill}
%
{\Large\bfseries\latinBy}
\par
\vspace*{\linespace}
%
{\LARGE\bfseries\latinstname}
\par
%
\vspace*{\fill}
%
{\Large\bfseries\latinsupervisor}
\par
\vspace*{\linespace}
%
{\LARGE\bfseries\latinsupname}
\par
\vspace*{\linespace}
{\LARGE\bfseries\latinsecsupname}
\par
%
\vspace*{\fill}
%
{\Large\bfseries\latinadvisor}
\par
\vspace*{\linespace}
%
{\LARGE\bfseries\latinadvname}
\par
\vspace*{\linespace}
{\LARGE\bfseries\latinsecadvname}
\par
%
\vspace*{\fill}
{\latinthesisdate}
\end{center}
\vspace*{5mm}
\end{latin}}
%
%-------------------------------------------------------------------------------------------------------------
%
\def\LatinAbstractName{ABSTRACT}
\newenvironment{LatinAbstractPage}{%
\clearpage
\begin{latin}
\thispagestyle{empty}
\par \vspace*{5ex}
\begin{center} \bfseries\large\LatinAbstractName \end{center}
\vspace*{3ex}
%
\begin{quote}
\bfseries\LARGE%\addtolength{\baselineskip}{.5\linespace}
\begin{center} \latinthesistitle \end{center}
\end{quote}
%
\vspace*{3ex}
%
\begin{center}
{\bfseries\large\latinBy}
\par
\vspace*{\linespace}
%
{\Large\bfseries\latinstname}
\end{center}
%
\vspace*{5ex}
%
}{\end{latin}\newpage}
%
%-------------------------------------------------------------------------------------------------------------
%
\def\MakeLatinEvaluationPage{%
\newpage
\begin{latin}
\thispagestyle{empty}
%
{\centerline{\large\bfseries In The Name of God}}
\par
%
\vspace*{\fill}
%
\begin{quote}
\centering\LARGE\bfseries
%    \addtolength{\baselineskip}{.5\linespace}
    \latinthesistitle
\end{quote}
%
\vspace*{\fill}
%
{\centerline{\large\bfseries\latinBy}}
\par
\vspace*{1ex}
{\centerline{\Large\latinstname}}
%
\par
\vspace*{\fill}
%
{\centerline{\bfseries\large THESIS}}
\par
\begin{center}
SUBMITTED TO THE SCHOOL OF GRADUATE STUDIES IN PARTIAL
FULFILLMENT OF THE REQUIREMENTS FOR THE DEGREE OF MASTER
OF SCIENCE (M.Sc.)
\end{center}
%
\vspace*{\fill}
%
\centerline{\Large\bfseries In}
\par
\vspace*{.5ex}
{\centerline{\Large\latinsubject~(\latinfield)}}
\par
\vspace*{\fill}
%
{\centerline{\large DAMGHAN UNIVERSITY}}
\par
{\centerline{\large DAMGHAN, ISLAMIC REPUBLIC OF IRAN}}
%
\par
\vspace*{\fill}
{\noindent EVALUATED AND APPROVED BY THE THESIS COMMITTEE AS: \ldegree}
\par
%
\vspace*{1ex}
%
{\renewcommand{\labelitemi}{}
\begin{itemize}
\small
\item \ltcmi
\item \ltcmii
\item \ltcmiii
\item \ltcmiv
\item \ltcmv
\item \ltcmvi
\item \ltcmvii
\end{itemize}
}
%
\vspace*{\fill}
%
{\centerline{\latinthesisdate}}
\end{latin}}
%
%-------------------------------------------------------------------------------------------------------------
\newcommand\persiangloss[2]{#1\dotfill\lr{#2}\\}
\newcommand\englishgloss[2]{#2\dotfill\lr{#1}\\}
%-------------------------------------------------------------------------------------------------------------
