 % in the name of Allah
% !TEX encoding = UTF-8 Unicode
\documentclass[a4paper,12pt]{xepersian-thesis}
\usepackage[top=30mm, bottom=25mm, left=25mm, right=30mm]{geometry}
\usepackage[usenames,dvipsnames]{pstricks}
\usepackage{epsfig}
\usepackage{pst-grad} % For gradients
\usepackage{pict2e}
\usepackage{pst-node}
\usepackage{pst-plot}
\usepackage{indentfirst}
\usepackage{listings}
\usepackage{color}
\usepackage{courier}

\usepackage[hidelinks]{hyperref}
\usepackage{url}
\usepackage{comment}

%for pseudocode‎\\
\usepackage{tocbibind}
\usepackage[ruled,algochapter]{algorithm2e}
\usepackage[noend]{algpseudocode}
% for long table
%\usepackage[margin=1cm]{geometry}% just for not having overfull lines
\usepackage{graphicx}
\usepackage{longtable,array}
\usepackage{multirow}

\usepackage{float}
\usepackage{enumerate}
\usepackage{amsmath, amssymb}
\usepackage{amsthm}
\usepackage{fancyhdr}
%\usepackage{graphicx}
\usepackage{setspace}
%\RequirePackage{hyperref}
\usepackage[font=small,format=plain,labelfont=bf,up,textfont=it,up]{caption} %Image captions reformatt
% \usepackage[final]{graphicx,hyperref}
\usepackage{subfig}
\usepackage{xepersian}
%\usepcackage[RomanFootNum]{xepersian}
\usepackage{fixltx2e}

\usepackage{bidi-longtable}

\settextfont{XB Zar}
\setlatintextfont{Times New Roman}
\SetAlFnt{\footnotesize}

\DeclareMathOperator{\argmin}{argmin}
\DeclareMathOperator{\argmax}{argmax}
\DeclareMathOperator{\cov}{cov}
\DeclareMathOperator{\corr}{corr}

\providecommand{\abs}[1]{\lvert#1\rvert}
\providecommand{\norm}[1]{\lVert#1\rVert}

\newtheorem{theorem}{قضیه}[chapter]
\newtheorem{lemma}[theorem]{لم}
\newtheorem{problem}{مسأله}[chapter]

\newtheorem{definition}{تعریف}[chapter]
\newcommand{\مهم}{\textbf}
\newtheorem{تعریف}{تعریف}[chapter]
\renewcommand{\labelenumii}{\theenumii}
\renewcommand{\theenumii}{\theenumi.\arabic{enumii}.}
\renewcommand{\algorithmicforall}{\textbf{for each}}
\newcommand{\listofalgorithmes}{\tocfile{\listalgorithmcfname}{loa}}
\renewcommand*{\listalgorithmcfname}{فهرست رویه‌ها}
\renewcommand*{\algorithmcfname}{رویه}
\renewcommand*{\algorithmautorefname}{رویه}

% for depth counter
\setcounter{secnumdepth}{5}
% for restarting footnote counter every page
%\usepackage{perpage} %the perpage package
%\MakePerPage{footnote} %the perpage package command
  

\begin{document}
\chapter{تست}

تست 1
\\ \\
%procedure 1
\begin{LTR}
\begin{algorithm}[H]
\label{proc:build1}
\setstretch{0.8}
\begin{RTL}
\caption{رویه‌ی اول} 
\end{RTL}
\SetKwFunction{proc}{build}
\SetKwProg{myproc}{Procedure}{}{end}
\SetKwInOut{Input}{input}
\SetKwInOut{Output}{output}

\myproc{\proc{}}{
\BlankLine
	\Input{A Process $M$}
	\Output{A Process $EM$}
}
\end{algorithm}
\end{LTR}

تست 2
\\ \\
%procedure 2
\begin{LTR}
\begin{algorithm}[H]
\label{proc:build2}
\setstretch{0.8}
\begin{RTL}
\caption{رویه‌ی دوم} 
\end{RTL}
\SetKwFunction{proc}{build}
\SetKwProg{myproc}{Procedure}{}{end}
\SetKwInOut{Input}{input}
\SetKwInOut{Output}{output}

\myproc{\proc{}}{
\BlankLine
	\Input{A Process $M$}
	\Output{A Process $EM$}
}
\end{algorithm}
\end{LTR}

\end{document}
