%	         			بِسْمِ اللهِ الرَّحْمٰنِ الرَّحيم ___________________________________________________________

\documentclass[twoside,a4paper,12pt]{thesis}
\usepackage{setspace,xargs}
% برای فاصله گذاری استاندارد بین خطوط و دستورات با چند آرگومان اختیاری
\usepackage{amsthm,amssymb,amsmath}
% فونت‌ها، نمادها و محیط‌های ams
%
\usepackage{float}
\usepackage [pagebackref=true, colorlinks, linkcolor=blue, citecolor=magenta, urlcolor=cyan] {hyperref}
% چنانچه قصد پرینت گرفتن نوشته خود را دارید، خط بالا را غیرفعال و  از دستور زیر استفاده کنید. در ضمن pagebackref برای نشان دادن شماره صفحه ارجاعات مراجع در بخش bibliography است.
%\usepackage[pagebackref=false]{hyperref}
\hypersetup{
pdftitle={Thesis Title},
pdfauthor={Farinaz Mostajeran},
pdfsubject={Master Thesis},
pdfkeywords={keywords},
pdfdirection={R2L}
}
\usepackage{tabularx,ragged2e,booktabs,caption}
\usepackage{graphicx,xcolor}
\graphicspath{{./images/}}
% پکیج رنگ و گرافیک و تعریف پوشه عکس‌ها
\usepackage [a4paper, bindingoffset=-.5cm, footskip=1cm, headheight = 16pt, top=3cm, bottom=2.5cm,  right=3cm,  left=3cm ] {geometry}
\setlength{\parskip}{0.3cm}
% ابعاد صفحه و حاشیه‌ها
\usepackage{fancyhdr}
% تنظیم Heading
\usepackage{cite}
% تنظیم ارجاعات
\usepackage[nottoc]{tocbibind}
% اضافه کردن مراجع و نمایه به فهرست مطالب
\usepackage[textfont=it]{caption}

\usepackage{titletoc}
\usepackage{xcolor}
\usepackage{tikz}

 \usepackage[linesnumbered,ruled,vlined]{algorithm2e}
 \usepackage{algorithmicx}

\usepackage{graphicx}
\usepackage{subfigure}
\usepackage{alltt}   % in package baraye estefade dar peyvaste baraye vared kardane matalebe command e MATLAB 

\usepackage{comment}
%\usepackage{hyperref}
% Glossaaires__________________________________________________ 
%\usepackage[xindy={language=persian,codepage=utf8},toc]{glossaries}
\usepackage[xindy,toc]{glossaries}
%
\renewcommand\glsnamefont[1]{\rm #1}
%
\newglossarystyle{listdotpage}{%
    \glossarystyle{listgroup}
    \renewcommand*{\glossaryentryfield}[5]{%
      \item[\glstarget{##1}{##2}, ##5] \dotfill\space ##3}}
%
\newglossarystyle{listpagedot}{%
    \glossarystyle{listgroup}
    \renewcommand*{\glossaryentryfield}[5]{%
      \item[\glstarget{##1}{##2}] \dotfill\space \rl{, ##5}##3}}
%
      \newglossarystyle{notation}{%
    \glossarystyle{list}
    \renewcommand*{\glossaryentryfield}[5]{%
     \item[\parbox{1.3cm}{\LTR{\glstarget{##1}{##2}}}] \hspace{5pt} ##3,\space ##5}}
%
\renewcommand{\glossaryname}{واژه‌نامه فارسی به انگلیسی و نمایه}
%\renewcommand{\entryname}{\rl{نماد}}
%\renewcommand{\descriptionname}{\rl{توضیح}}
%\renewcommand{\pagelistname}{\rl{صفحه}}
%\setlength{\glsdescwidth}{60pt}
%
\newglossary[epx]{dicep}{epi}{epd}{واژه‌نامه انگلیسی به فارسی}
\GlsSetXdyLanguage[dicep]{english}
\makeglossaries
\loadglsentries{./chapters/dic.tex}
%\glsdisablehyper
\renewcommand\glsdisplayfirst[4]{\textit{#1}}
%\newcommand\gi[1]{\gls{#1}\index{\glsentrysort{#1}@\glsentrytext{#1}}}
\newcommand\gi[1]{\gls{#1}\glslink{ep#1}{}}
% دستور درج کلمه و اضافه شدن به واژه نامه
\newcommand\gn[1]{\glsentrytext{#1}}
% دستور درج کلمه بدون اضافه شدن به واژه نامه
\newcommand\gfirst[1]{\glsreset{#1}\gls{#1}\glslink{ep#1}{}}
% دستور درج کلمه به صورت ظهور اولین بار و اضافه شدن به واژه نامه
%   XePersian____________________________________________________ 
%%%%%%%%%%%%%%%%%%%%%%%%%%%55
\usepackage{fontspec}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%55555
\usepackage{titlesec}
\usepackage{xepersian}
%\usepackage{fontspec}
\usepackage{./styles/tempfix}
\settextfont[Scale=1.13]{Yas}
%\settextfont[Scale=1.13,Ligatures=TeX]{Yas}
%\settextfont[Scale=1.13,parsidigits]{Yas}
%\DefaultMathsDigits
\PersianMathsDigits
 \setmathdigitfont[Scale=1.13]{Yas}
 %\setmathdigitfont[Scale=1.13]{PGaramond}
%\setdigitfont[Scale=1.1]{Yas}
%\setmathsfont{Yas}
%\setdigitfont[Scale=1]{Parsi Digits}
%\settextfont[Scale=1.13]{XB Niloofar}
%\setdigitfont[Scale=1.1]{PGaramond}
%\setdigitfont{XB Niloofar}
%\setdigitfont{XB Niloofar}
%\setdigitfont{Yas}
%\setlatintextfont[ExternalLocation,BoldFont={lmroman10-bold},BoldItalicFont={lmroman10-bolditalic},ItalicFont={lmroman10-italic}]{lmroman10-regular}
\defpersianfont\nastaliq[Scale=2]{IranNastaliq}
\defpersianfont\titr[Scale=1]{B Titr}
\defpersianfont\traffic[Scale=1]{B Traffic}
%%

%\titlespacing*{\sectionHlpcH*4H*2.3}[lpc] 
%   Titles__________________________________________________________
\renewcommand{\abstractname}{\Large چکیده}
\renewcommand{\listfigurename}{فهرست تصاویر}
\renewcommand{\latinabstract}{}
\renewcommand{\proofname}{\textbf{برهان}}
\renewcommand{\qedsymbol}{$\blacksquare$}
\renewcommand{\bibname}{مراجع}
\newcommand{\sectionname}{}
%    Environments_________________________________________________ 
\newcounter{theorem}[section]
\newcommand{\environ}[2]{\vspace{7pt} \refstepcounter{theorem}\par\noindent  \textbf{\hboxR{#1}\space\thetheorem} \textbf{\space\hboxR{#2}} }%\\[5pt]}
\newcommand{\closeenviron}{\par\vspace{3pt}}
\newenvironment{thm}[1][]{\environ{قضیه}{#1}\it}{\closeenviron}
\newenvironment{lem}[1][]{\environ{لم}{#1}\it}{\closeenviron}
\newenvironment{prop}[1][]{\environ{گزاره}{#1}\it}{\closeenviron}
\newenvironment{cor}[1][]{\environ{نتیجه}{#1}\rm}{\hfill $\blacktriangle$ \closeenviron}
\newenvironment{con}[1][]{\environ{حدس}{#1}\it}{\hfill $\blacktriangle$ \closeenviron}
\newenvironment{dfn}[1][]{\environ{تعریف}{#1}\rm}{‌\hfill $\blacktriangle$ \closeenviron}
\newenvironment{notation}[1][]{\environ{نماد}{#1}\rm}{‌\hfill $\blacktriangledown$ \closeenviron}
\newenvironment{rem}[1][]{\environ{ملاحظه}{#1}\rm}{‌\hfill $\blacklozenge$ \closeenviron}
\newenvironment{exm}[1][]{\environ{مثال}{#1}\rm}{‌\hfill $\bigstar$ \closeenviron}
%\newenvironment{Proof}[1][]{\environ{برهان}{#1}\rm}{‌\hfill $\blacksquare$ \closeenviron}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\algorithmiccomment}[1]{$\triangleright$ #1}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
%\renewcommand{\algorithmiccomment}[1]{$\triangleright$ #1}

\newcommand{\amin}[1]{\mathrm{argmin}_{#1} }
\newcommand{\reg}{\mathrm{regret}}
\newcommand{\gr}[1]{\bigtriangledown_{#1}}
\newcommand{\OCO}{\mathrm{OCO}}
\newcommand{\vc}[1]{\textbf{#1}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
%\makeatletter
%\newenvironment{prob}[4][]{\@ifempty{#1}
%{\vspace{15pt} \par\noindent
%\parbox{15cm}{\hskip 7pt\underline{\bf #2}\\[4pt]
%\begin{tabular}{p{40pt}l}
%\textbf{نمونه:}& \parbox[t]{11.8cm}{#3}\\[7pt]
%\textbf{سوال:}& \parbox[t]{11.8cm}{#4}
%\end{tabular}\vspace{5pt}
%}}
%{\vspace{5pt} \par\noindent
%\parbox{15cm}{\hskip 7pt\underline{\bf #2}\\[4pt]
%\begin{tabular}{p{40pt}l}
%\textbf{ثابت‌ها:}& \parbox[t]{11.5cm}{#1}\\[4pt]
%\textbf{نمونه:}& \parbox[t]{11.5cm}{#3}\\[7pt]
%\textbf{سوال:}& \parbox[t]{11.5cm}{#4}
%\end{tabular}\vspace{5pt}
%}}} {\\[5pt]}
%\makeatother
%  table of contents _
%____________________________________
%\makeatletter
%\bidi@patchcmd{\@makechapterhead}{\thechapter}{\tartibi{chapter}}{}{}
%\bidi@patchcmd{\@chapter}{\addcontentsline{toc}{chapter}{\protect\numberline{\thechapter}#1}}%
%{\addcontentsline{toc}{chapter}{\protect\numberline{\chaptername~\tartibi{chapter}}#1}}{}{}
%\bidi@patchcmd{\l@chapter}{\setlength\@tempdima{1.5em}}{\setlength\@tempdima{4em}}
%{\typeout{Suceeded}}{\typeout{Failed}}
%\makeatother



%%
%\titlecontents{chapter}% <section-type>
%  [0pt]% <left>
%  {}% <above-code>
%  {\bfseries\chaptername\ \tartibinumeral{\thecontentslabel}\quad\hfil}% <numbered-entry-format>
%  {}% <numberless-entry-format>
%  {\bfseries\hfill\contentspage}% <filler-page-format>
% % \titleformat{\chapter}[display]
%  %{\fontsize{30pt}{30pt}\selectfont\bfseries}{}{}{}
%  %{\farsio\chaptertitlename\ \thechapter}{20pt}{\Huge}
\titleformat{\part}[display]{ \bfseries   \filleft\Huge}
{ \enspace \chaptername\  \thechapter}
{6pt}{\bfseries\filleft}
%برخی تن	ظیمات برای عنوان فهرست مطالب
\titlecontents{chapter} [3pc] 
{\color{blue!50}\titlerule[3pt]\addvspace{1pc}\bfseries \filleft} 
{\color{black}\contentslabel 
[{\chaptername}
\thecontentslabel]{3pc}\hspace{4mm}}
%%%%%New 
{\color{black}}{\color{black}\hfill\contentspage} [\addvspace{1pc}] 
%تنظیم نوع فهرست مطالب
\titlecontents{section}[4pc]{\addvspace{2pt}\filleft} 
{\contentslabel[\sectionname\ \thecontentslabel\ ]{3pc}} 
{}{\dotfill \contentspage}
%چپ چین کردن  

%   Counters ___________________________________________________
\def\thesection{\arabic{section}.\thechapter}
\def\thesubsection{\arabic{subsection}.\thesection}
\def\theequation{\arabic{equation}.\thechapter}
\def\thetheorem{\arabic{theorem}.\thesection}
\def\thefigure{\arabic{figure}.\thechapter}
\def\thetable{\arabic{table}.\thechapter}
%\numberwithin{equation}{section}
%   Main body__________________________________________________
%
\headheight = 20pt
\pagestyle{plain}%\titleformat{\chapter}[display]{ \filright\Huge}
%{\enspace \chaptername\  \thechapter}
%{6pt}{\bfseries\filright}
%%برخی تنظیمات برای عنوان فهرست مطالب
%\titlecontents{chapter} [3pc] 
%{\color{blue!50}\titlerule[3pt]\addvspace{1pc}\bfseries \filleft} 
%{\color{black}\contentslabel 
%[{\chaptername}
%\thecontentslabel]{3pc}\hspace{4mm}}%%%%%%New 
%{\color{black}}{\color{black}\hfill\contentspage} 
%[\addvspace{1pc}] 
%%تنظیم نوع فهرست مطالب
%\titlecontents{section}[4pc]{\addvspace{2pt}\filleft} 
%{\contentslabel[\sectionname\ \thecontentslabel\ ]{3pc}} 
%{}{\dotfill \contentspage}
\fancyhf{}
\doublespacing
\allowdisplaybreaks[1]
% اجازه برای شکستن صفحه در وسط محیط ریاضی
\begin{document}
\begin{center}
\begin{figure}
\includegraphics[scale=1]{b1.jpg}
\end{figure}
\end{center}
\university{دانشگاه صنعتی شریف}
\department{دانشکده علوم ریاضی}
\type{رساله}
\subject{ پایان‌نامه کارشناسی ارشد ریاضی محض}
\field{ریاضی محض}
\title{تعمیم مسئله پیش‌بینی برخط}
% اگر عنوان پایان‌نامه شما طولانی است می‌توانید بخشی از آن را در قسمت زیر وارد کنید. 
\tit{بر اساس نظر مشاوران}
%تاریخ دفاع
\newcommand{\repdate}{$\ \ 93 / \  6/ \  23$}
%زمان دفاع
\reptime{ یک‌‌شنبه \hspace{5pt} \repdate ساعت\ \space $8$   صبح}
%محل دفاع
\repplace{  }
\supervisor{دکتر محمد هادی فروغمند اعرابی}
\supervisorh{دکتر کسری علیشاهی }
\advisor{  دکتر حمیده حسین‌زاده سرشکی }
\mrmiss{خانم}
%جنسیت نویسنده
\author{فاطمه توانگریان}
%داور اول
\refreeA{ دکتر ...}
%داور دوم
\refreeB{ دکتر ...}
%سرپرست تحصیلات تکمیلی
\DGC{دکتر مرتضی فتوحی فیروز‌آبادی  }
\thesisdate{دی ۱۳۹۸}
%
\approval
\makefatitle
\makethat


%  Acknowledgement & Rights ______________________________________
\input{./chapters/acknowledge}
%شهریور 
\newpage
\thispagestyle{empty}
\ \vfill
\vspace{-12cm}
\tikzstyle{tmpvip}=%
[ultra thick,rectangle,draw=black!72,rounded corners=2mm,%
inner xsep=-1cm,inner ysep=0.4cm]
\begin{center}
\begin{tikzpicture}
\node[tmpvip](mainbox){%
\begin{minipage}{0.7\textwidth}
\begin{persian}
\begin{center}

\textbf{کلیه حقوق مادی مترتّب بر نتایج مطالعات، ابتکارات}

 \textbf{و نوآوری‌های ناشی از تحقیق موضوع این پایان‌نامه}
 
\textbf{متعلّق به دانشگاه صنعتی شریف است.}

\end{center}
\end{persian}
\end{minipage}};
%\node[viptitle] at (mainbox.west){\ding{'153}};
\end{tikzpicture}
\end{center}
\ \vfill
% List of Contents, Figures and Abstract _______________________________
\begin{spacing}{1.7}
\tableofcontents
%\listoffigures  %new برای فهرست تصاویر
%\listoftables  %new برای فهرست جداول

\end{spacing}
\titleformat{\chapter}[display]{ \filright\Huge}%برای چپ نویسی عنوان ابتدای هر فصل
{\enspace \chaptername\  \thechapter}
{6pt}{\bfseries\filright}
%\titleformat{\chapter}[display]{ \fillift\Huge}برای راست نویسی عنوان ابتدای هر فصل
%{\enspace \chaptername\  \thechapter}
%{6pt}{\bfseries\filleft}
\input{./chapters/nn}
\pagebreak

\input{./chapters/abstract}
%   Chapter___s ____________________________________________________
\pagestyle{fancy}
%دستوری برای اینکه کشیدگی در کلمات ایجاد شود
\abovedisplayshortskip=10pt
\belowdisplayshortskip=8pt
%دستوری برای تنظیم فاصله عمودی قبل و بعد از فرمول‌ها
%%%%%%%%%%%%%%%%%%%%%%شماره صفحه و عنوان فصل
%\rhead{\leftmark}

\cfoot{\thepage }

\fancyhead[LO]{\leftmark}
\fancyhead[RE]{\rightmark}
%\lhead{\rightmark}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%chapter  فصل

\input{./chapters/preface}
\input{./chapters/chapter2}
\input{./chapters/chapter3}
\input{./chapters/chapter4}
%\input{./chapters/chapter5}
\input{./chapters/chapter6}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%appendix  پیوست
\appendix
\renewcommand{\chaptername}{پیوست}
%
\titlecontents{chapter} [3pc] 
{\color{blue!50}\titlerule[3pt]\addvspace{1pc}\bfseries \filleft} 
{\color{black}\contentslabel 
[{\appendixname}
\thecontentslabel]{3pc}\hspace{4mm}}%%%%%%New
{\color{black}}{\color{black}\hfill\contentspage} 
[\addvspace{1pc}] 
%
\def\thesection{\thechapter.\arabic{section}}
\def\thesubsection{\thesection.\arabic{subsection}}
\def\theequation{\thechapter.\arabic{equation}}
\def\thetheorem{\thechapter.\arabic{theorem}}
\def\thefigure{\thechapter.\arabic{figure}}
\def\thetable{\thechapter.\arabic{table}}
%
%\input{./chapters/appendix1}
%\input{./chapters/appendix2}
%\input{./chapters/appendix3}

% Print Bibs & Glossaries _____________________________________________
\titleformat{\chapter}[display]{ \filright\Huge}
{\enspace \chaptername\  \thechapter}
{6pt}{\bfseries\filleft}
%%%%%%New
\titlecontents{chapter} [4pc] 
{\color{blue!50}\titlerule[3pt]\addvspace{1pc}\bfseries \filleft} 
{\color{black}\contentslabel 
[{\appendixname}
\thecontentslabel]{3pc}}
{\color{black}}{\color{black}\hfill\contentspage} 
[\addvspace{1pc}] 
%دستور تنظیم وسطچین برای عنوان مراجع و واژه‌نامه
\normalsize
\small
{\bibliographystyle{unsrt-fa}
%\setLTRbibitems
\DefaultMathsDigits
\begin{singlespace}
\bibliography{./chapters/bibliography}
%
\renewcommand{\glossarypreamble}{}
\renewcommand{\glossarypostamble}{}
\printglossary[style=listdotpage,type=main]
\renewcommand{\glsnamefont}[1]{\rm{\latinfont #1}}
\renewcommand{\glossarypreamble}{\setLTR\DefaultMathsDigits}
\renewcommand{\glossarypostamble}{\setRTL\AutoMathsDigits}
\printglossary[style=listpagedot,type=dicep]
\end{singlespace}
%
%  Latin Abstract _________________________________________________\\
\renewcommand{\baselinestretch}{1.1}%%%% you can use 1.1, too.
\begin{latin}
\latintitle{Generalization of the online prediction problem based on expert advice}
\latinauthor{Fatemeh Tavangarian}
\latindegree{Master of Science}
\authoremail{tavangarian15[at]gmail.com}
\latinthesisdate{14.10.2014}
\latinthesisyear{14.10.2014}
\latinsupervisor{Dr Mohammad- Hadi Foroughmand- Araabi}
%\supervisorm{Assistant Professor}
\supervisoremail{foroughmand[at]sharif.ir}
\latinsupervisorh{Dr Kasra Alishahi}
%\supervisorm{Assistant Professor}
\supervisoremailh{alishahi[at]sharif.ir}
\latinadvisor{Dr. ...}
\advisorm{Assistant Professor}
\advisoremail{...@cc.iut.ac.ir}
\latinrefreeA{Dr. ....}
%\refreeAm{Assistant Professor}
\latinrefreeB{Dr. ...}
%\refreeBm{Assistant Professor}
\latinDGC{Dr Morteza Fotouhi Firouzabad }
%\latinDGCm{Associate Professor}
\latinfaculty{Department of Mathematical Sciences}
\latinuniversity{Sharif University of Technology}
\latincity{}
\MSC{$68Q32$
;
$68T05$
; 
$90C27 $}
\latinkeywords{	regret minimization, online convex optimization , expert advice problem}
\makelatinabstract
\makelatintitle
\end{latin}
%_________________________________________________________________
\end{document}
