summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty')
-rw-r--r--Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty864
1 files changed, 517 insertions, 347 deletions
diff --git a/Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty b/Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty
index aa56bf6bf59..c74d4a8723b 100644
--- a/Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty
+++ b/Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty
@@ -6,34 +6,192 @@
%% conditions of the LaTeX Project Public License, either version 1.3c
%% of this license or (at your option) any later version.
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{xepersian}[2009/01/05 v0.163
+\ProvidesPackage{xepersian}[2009/02/20 v1
Persian typesetting in XeLaTeX (Author: Vafa Khalighi)]
\AtBeginDocument{\special{pdf: docinfo <<
- /Creator (XePersian v0.163)
+ /Creator (XePersian v1 (Author: Vafa Khalighi))
>>}}
\RequirePackage{graphicx}
\RequirePackage{amssymb}
\RequirePackage{amsmath}
\RequirePackage{amsthm}
\RequirePackage{fontspec}
-\RequirePackage{xltxtra}
-\RequirePackage{bidi}
\RequirePackage{etoolbox}
\RequirePackage{xepersian-mathsdigitspec}
\RequirePackage{xunicode}
-
-\@rltrue
-\@rlmaintrue
-\@rl@footnotetrue
-
+\gdef\@latex@error#1#2{%
+ \GenericError{%
+ \space\space\space\@spaces\@spaces\@spaces
+ }{%
+ XePersian Error: #1%
+ }{%
+ Please first produce a similar file without using XePersian package and then compile it with xelatex, if you got the same error, then please study the Persian translation of 'The not so Short Introduction to LaTeX' by MEHDI OMIDALI, otherwise please report the error with a minimal tex file which shows the error to the Author of XePersian.%
+ }{#2}%
+}
+\gdef\@latexbug{%
+ \@latex@error{This may be a XePersian bug}{Please inform the Author of XePersian}}
+\TeXXeTstate=1
+\newif\if@RTL
+\def\XePersian@RTL@everypar{\if@RTL{\setbox\z@\lastbox\beginR\usebox\z@}\fi}
+ \let\o@everypar=\everypar
+ \newtoks\n@everypar
+ \n@everypar\expandafter{\the\o@everypar}
+ \o@everypar{\XePersian@RTL@everypar\the\n@everypar}
+ \let\everypar=\n@everypar
+\@RTLtrue
+\def\list#1#2{%
+ \ifnum \@listdepth >5\relax
+ \@toodeep
+ \else
+ \global\advance\@listdepth\@ne
+ \fi
+ \rightmargin\z@
+ \listparindent\z@
+ \itemindent\z@
+ \csname @list\romannumeral\the\@listdepth\endcsname
+ \def\@itemlabel{#1}%
+ \let\makelabel\@mklab
+ \@nmbrlistfalse
+ #2\relax
+ \@trivlist
+ \parskip\parsep
+ \parindent\listparindent
+ \advance\linewidth -\rightmargin
+ \advance\linewidth -\leftmargin
+ \if@RTL
+ \advance\@totalleftmargin \rightmargin
+ \else
+ \advance\@totalleftmargin \leftmargin
+ \fi
+ \parshape \@ne \@totalleftmargin \linewidth
+ \ignorespaces}
+\def\raggedright{%
+ \let\\\@centercr
+ \leftskip\z@skip\rightskip\@flushglue
+ \parindent\z@\parfillskip\z@skip}
+\let\@@raggedleft=\raggedleft
+\let\@@raggedright=\raggedright
+\renewcommand\raggedleft{\if@RTL\@@raggedright%
+ \else\@@raggedleft\fi}
+\renewcommand\raggedright{\if@RTL\@@raggedleft%
+ \else\@@raggedright\fi}
\def\raggedright{%
\let\\\@centercr
\rightskip\z@skip\rightskip\@flushglue
\parindent\z@\parfillskip\z@skip}
\renewcommand\raggedleft{\@@raggedleft}
\renewcommand\raggedright{\@@raggedright}
+\def\centerline#1{%
+\if@RTL\@@line{\hss\beginR#1\endR\hss}
+\else\@@line{\hss#1\hss}\fi}
+\def\leftline#1{%
+\if@RTL\@@line{\beginR#1\endR\hss}
+\else\@@line{#1\hss}\fi}
+\def\rightline#1{%
+\if@RTL\@@line{\hss\beginR#1\endR}
+\else\@@line{\hss#1}\fi}
+\def\leftmark{\beginR\expandafter\@leftmark\botmark\@empty\@empty\endR}
+\def\rightmark{\beginR\expandafter\@rightmark\firstmark\@empty\@empty\endR}
+\def\underline#1{%
+ \relax
+ \ifmmode\@@underline{#1}%
+ \else
+\if@RTL $\@@underline{\hbox{\beginR#1\endR}}\m@th$\relax
+\else
+$\@@underline{\hbox{#1}}\m@th$\relax\fi\fi}
+\newif\if@tabsw
+\global\@tabswfalse
+\def\@tabular{\if@RTL\global\@tabswtrue\fi
+ \leavevmode \hbox \bgroup \if@tabsw\beginR \fi
+ $\let\@acol\@tabacol
+ \let\@classz\@tabclassz
+ \let\@classiv\@tabclassiv \let\\\@tabularcr\@tabarray}
+\def\endtabular{\crcr\egroup\if@tabsw\egroup\endR\egroup\fi
+ \egroup $\if@tabsw\endR\fi \egroup
+ \global\@tabswfalse}
+\expandafter \let \csname endtabular*\endcsname = \endtabular
-
+\def\@array[#1]#2{\setbox\@arstrutbox=\hbox{\vrule
+ height\arraystretch \ht\strutbox
+ depth\arraystretch \dp\strutbox
+ width\z@}\@mkpream{#2}\edef\@preamble{%
+\halign \noexpand\@halignto
+\bgroup \tabskip\z@ \@arstrut \@preamble \tabskip\z@ \cr}%
+\let\@startpbox\@@startpbox \let\@endpbox\@@endpbox
+\if #1t\vtop \else \if#1b\vbox \else \vcenter \fi\fi
+\bgroup \let\par\relax
+\let\@sharp##\let\protect\relax \lineskip\z@\baselineskip\z@
+\if@tabsw\hbox\bgroup\beginR\vbox\bgroup\fi
+\@preamble}
+\def\@dottedtocline#1#2#3#4#5{\ifnum #1>\c@tocdepth \else
+ \vskip \z@ plus .2pt
+ {\hangindent #2\relax
+ \if@RTL \leftskip \else \rightskip \fi
+ \@tocrmarg \parfillskip -\if@RTL \leftskip \else
+ \rightskip \fi
+ \parindent #2\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima #3\relax
+ #4\nobreak\leaders
+ \hbox{$\m@th \mkern \@dotsep mu.\mkern \@dotsep
+ mu$}\hfill \nobreak
+ \hbox to\@pnumwidth{\hfil #5}\par}\fi}
+\def\RTL@outputdblcol{\if@firstcolumn
+\global\@firstcolumnfalse
+ \global\setbox\@leftcolumn\box\@outputbox
+ \else \global\@firstcolumntrue
+ \setbox\@outputbox\vbox{%
+ \hbox to\textwidth{%
+ \hbox to\columnwidth{\box\@outputbox \hss}%
+ \hfil \vrule width\columnseprule\hfil
+ \hbox to\columnwidth{\box\@leftcolumn \hss}%
+ }}\@combinedblfloats
+\@outputpage \begingroup \@dblfloatplacement
+\@startdblcolumn
+\@whilesw\if@fcolmade \fi
+{\@outputpage\@startdblcolumn}\endgroup
+ \fi}
+\def\LTR@outputdblcol{\if@firstcolumn
+\global\@firstcolumnfalse
+ \global\setbox\@leftcolumn\box\@outputbox
+ \else \global\@firstcolumntrue
+ \setbox\@outputbox\vbox{\hbox to\textwidth{%
+ \hbox to\columnwidth
+ {\box\@leftcolumn \hss}\hfil
+ \vrule width\columnseprule\hfil
+ \hbox to\columnwidth{\box\@outputbox \hss}}}%
+ \@combinedblfloats
+ \@outputpage \begingroup \@dblfloatplacement
+ \@startdblcolumn
+ \@whilesw\if@fcolmade \fi
+ {\@outputpage\@startdblcolumn}\endgroup
+ \fi}
+\newcommand{\RTLdblcol}{\renewcommand{\@outputdblcol}{\RTL@outputdblcol}}
+\newcommand{\LTRdblcol}{\renewcommand{\@outputdblcol}{\LTR@outputdblcol}}
+\RTLdblcol
+\long\def\@makecaption#1#2{%
+ \vskip 10pt%
+ \setbox\@tempboxa\hbox{#1: #2}%
+ \ifdim \wd\@tempboxa >\hsize \if@RTL\beginR\fi#1: #2\par%
+ \else \hbox
+to\hsize{\if@RTL\beginR\fi\hfil\box\@tempboxa\hfil%
+\if@RTL\endR\fi}%
+ \fi}
+\renewenvironment{equation}{%
+ \incr@eqnum
+ \mathdisplay@push
+ \st@rredfalse \global\@eqnswtrue
+ \beginL\mathdisplay{equation}%
+}{%
+ \endmathdisplay{equation}\endL%
+ \mathdisplay@pop
+ \ignorespacesafterend
+}
+\let\@@text=\text
+\def\text#1{\@@text{\beginR#1\endR}}
+\def\tagform@#1{\maketag@@@{)\ignorespaces\text{#1}\unskip\@@italiccorr(}}
+\renewcommand{\eqref}[1]{\beginL\textup{\tagform@{\ref{#1}}}\endL}
\@ifpackageloaded{graphicx}{%
\def\Gin@ii[#1]#2{%
\def\@tempa{[}\def\@tempb{#2}%
@@ -50,55 +208,40 @@
\endgroup
\fi}%
}{}
-
-\def\lr#1{\LR{\rmfamily#1}}
-\def\rl#1{\RL{\persianfont#1}}
-\def\LTR{\bgroup\par\@rlfalse}
-\def\endLTR{\par\egroup}
-\def\RTL{\bgroup\par\@rltrue}
-\def\endRTL{\par\egroup}
-\def\roman{\bgroup\par\@rlfalse\rmfamily}
-\def\endroman{\par\egroup}
-\def\persian{\bgroup\par\@rltrue\persianfont}
-\def\endpersian{\par\egroup}
-\def\Roman{\if@rl\par\@rlfalse\rmfamily\fi}
-\def\Persian{\if@rl\relax\else\par\@rltrue\persianfont\fi}
-
-\def\centerline#1{%
-\if@rl\@@line{\hss\beginR #1 \endR\hss}
-\else\@@line{\hss#1\hss}\fi}
-
-\def\leftline#1{%
-\if@rl\@@line{\beginR #1 \endR\hss}
-\else\@@line{#1\hss}\fi}
-
-\def\rightline#1{%
-\if@rl\@@line{\hss\beginR #1 \endR}
-\else\@@line{\hss#1}\fi}
-
+\@ifpackageloaded{fancyhdr}{%
+\def\@fancyhead#1#2#3#4#5{\beginR#1\endR\hbox to\headwidth{\fancy@reset
+ \@fancyvbox\headheight{\hbox
+ {\rlap{\parbox[b]{\headwidth}{\raggedright\beginR#2\endR}}\hfill
+ \parbox[b]{\headwidth}{\centering\beginR#3\endR}\hfill
+ \llap{\parbox[b]{\headwidth}{\raggedleft\beginR#4\endR}}}\headrule}}\beginR#5\endR}
+\def\@fancyfoot#1#2#3#4#5{\beginR#1\endR\hbox to\headwidth{\fancy@reset
+ \@fancyvbox\footskip{\footrule
+ \hbox{\rlap{\parbox[t]{\headwidth}{\raggedright\beginR#2\endR}}\hfill
+ \parbox[t]{\headwidth}{\centering\beginR#3\endR}\hfill
+ \llap{\parbox[t]{\headwidth}{\raggedleft\beginR#4\endR}}}}}\beginR#5\endR}
+}{}
+\@ifpackageloaded{draftwatermark}{%
+\renewcommand\SetWatermarkText[1]{%
+ \def\sc@wm@text{\if@RTL\beginR\fi#1\if@RTL\endR\fi}}
+}{}
+\newfontscript{Persian}{arab}
+\newfontlanguage{Persian}{ARA}
\newcommand*\settextfont[2][]{%
-\newfontfamily\persianfont[Script=Arabic,Mapping=parsidigits,#1]{#2}
+\newfontfamily\persianfont[Script=Persian,Mapping=parsidigits,#1]{#2}
\let\rmdefault\zf@family
\normalfont
}
\newcommand*\setromantextfont[2][]{%
\newfontfamily\rmfamily[Mapping=tex-text,#1]{#2}
}
-
-
\newcommand*\defpersianfont[1]{%
\@ifnextchar[{\defpersianfont@i#1}{\defpersianfont@i#1[]}}
\def\defpersianfont@i#1[#2]#3{%
- \zf@fontspec{Script=Arabic,Mapping=parsidigits,#2}{#3}%
+ \zf@fontspec{Script=Persian,Mapping=parsidigits,#2}{#3}%
\edef\@tempa{%
\noexpand\DeclareRobustCommand\noexpand#1
{\noexpand\fontfamily{\zf@family}\noexpand\selectfont}}%
\@tempa}
-
-
-
-
-
\newcommand*\defromanfont[1]{%
\@ifnextchar[{\defromanfont@i#1}{\defromanfont@i#1[]}}
\def\defromanfont@i#1[#2]#3{%
@@ -107,17 +250,27 @@
\noexpand\DeclareRobustCommand\noexpand#1
{\noexpand\fontfamily{\zf@family}\noexpand\selectfont}}%
\@tempa}
-
-
-
-
-
-\def\ps@plain{\ps@empty
- \def\@oddfoot{\hfil\thepage\hfil}%
- \let\@evenfoot\@oddfoot
- \let\@oddhead\@empty\let\@evenhead\@empty
-}
-
+\let\n@xt=\
+\def\LRE{\protect\pLRE}%
+\def\pLRE{\protect\afterassignment\moreLRE \let\n@xt= }
+\def\moreLRE{\bracetext \aftergroup\endL \beginL\@RTLfalse}
+\def\RLE{\protect\pRLE}
+\def\pRLE{\protect\afterassignment\moreRLE \let\n@xt= }
+\def\moreRLE{\bracetext \aftergroup\endR \beginR\@RTLtrue}
+\def\bracetext{\ifcat\n@xt{\else\ifcat\n@xt}\fi
+ \errmessage{Missing left brace has been substituted}\fi \bgroup}
+\def\lr#1{\begingroup\beginL\rmfamily#1\endL\endgroup}
+\def\rl#1{\begingroup\beginR\persianfont#1\endR\endgroup}
+\def\LTR{\bgroup\par\@RTLfalse}
+\def\endLTR{\par\egroup}
+\def\RTL{\bgroup\par\@RTLtrue}
+\def\endRTL{\par\egroup}
+\def\roman{\bgroup\par\@RTLfalse\rmfamily}
+\def\endroman{\par\egroup}
+\def\persian{\bgroup\par\@RTLtrue\persianfont}
+\def\endpersian{\par\egroup}
+\def\Roman{\if@RTL\par\@RTLfalse\rmfamily\fi}
+\def\Persian{\if@RTL\relax\else\par\@RTLtrue\persianfont\fi}
\newif\ifFT@leap \newif\ifFT@kabiseh
\newcount\FT@i \newcount\FT@y \newcount\FT@m \newcount\FT@d
@@ -300,117 +453,71 @@
آبان\or آذر\or
دی\or بهمن\or
اسفند\fi}
-
-
\let\originaltoday=\today
\def\today{\lr{\originaltoday}}
\let\romantoday\today
\def\today{\rl{\ftoday}}
-\def\leftmark{\RL{\expandafter\@leftmark\botmark\@empty\@empty}}
-\def\rightmark{\RL{\expandafter\@rightmark\firstmark\@empty\@empty}}
-
-
\newcommand\twocolumnstableofcontents{%
\begin{multicols}{2}[\section*{\contentsname}]%
\small
\@starttoc{toc}%
\end{multicols}}
-
\def\rcases#1{\left.\vcenter{\normalbaselines\m@th
\ialign{$##\hfil$&\quad{##}\hfil\crcr#1\crcr}}\,\right\}}
-
-
-\def\thefootnote{\arabic{footnote}}
-\def\thefigure{\arabic{figure}}
-\def\thetable{\arabic{table}}
-\def\theequation{\arabic{equation}}
-
-\def\figurename{\@ensure@RL{شکل}}
-\def\tablename{\@ensure@RL{جدول}}
-\def\contentsname{\@ensure@RL{فهرست مطالب}}
-\def\listfigurename{\@ensure@RL{لیست تصاویر}}
-\def\listtablename{\@ensure@RL{لیست جداول}}
-\def\appendixname{\@ensure@RL{پیوست}}
-\def\indexname{\@ensure@RL{نمایه}}
-\def\refname{\@ensure@RL{مراجع}}
-\def\abstractname{\@ensure@RL{چکیده}}
-\def\partname{\@ensure@RL{بخش}}
-\def\datename{\@ensure@RL{تاریخ:}}
-\def\bibname{\@ensure@RL{کتاب‌نامه}}
-\def\chaptername{\@ensure@RL{فصل}}
-\def\ccname{\@ensure@RL{رونوشت}}
-\def\enclname{\@ensure@RL{پیوست}}
-\def\pagename{\@ensure@RL{صفحه}}
-\def\headtoname{\@ensure@RL{به}}
-\def\proofname{\@ensure@RL{اثبات}}
-
-
\def\reflect#1{{\setbox0=\hbox{#1}\rlap{\kern0.5\wd0
\special{x:gsave}\special{x:scale -1 1}}\box0 \special{x:grestore}}}
\def\XePersian{\leavevmode$\smash{\hbox{X\lower.5ex
\hbox{\kern-.125em\reflect{E}}Persian}}$}
-
-
-
-
-
-\renewenvironment{equation}{%
-\beginL
- \incr@eqnum
- \mathdisplay@push
- \st@rredfalse \global\@eqnswtrue
- \mathdisplay{equation}%
-}{%
- \endmathdisplay{equation}%
- \mathdisplay@pop
- \ignorespacesafterend
-}
-
-
-\newif\if@RomanBibNum
-\def\@@number#1{\ifmmode\else\beginL\fi{\if@RomanBibNum#1\else\persianfont#1\fi}\ifmmode\else\endL\fi}
-\def\RomanBibNum{\@RomanBibNumtrue}
-\def\PersianBibNum{\@RomanBibNumfalse}
-\@RomanBibNumtrue
-\DeclareOption{PersianBibNum}{\@RomanBibNumfalse}
-\def\@number{\protect\@@number}
-\let\@persian=\@arabic
-\let\@@arabic=\@arabic
-\let\@@alph=\@alph
-\let\@@Alph=\@Alph
-\def\@arabic#1{\ifmmode\else\@number{\@@arabic#1}\fi}
-\def\arabicnorl#1{\expandafter\@@arabic\csname c@#1\endcsname}
-\def\make@lr#1{\begingroup
- \toks@=\expandafter{#1}%
- \edef\x{\endgroup
- \def\noexpand#1{\noexpand\@number{\the\toks@}}}%
- \x}
-\def\@character#1{\ifcase#1\or الف\char"200D\or ب\or پ\or ت\or ث\or
+\def\figurename{شکل}
+\def\tablename{جدول}
+\def\contentsname{فهرست مطالب}
+\def\listfigurename{لیست تصاویر}
+\def\listtablename{لیست جداول}
+\def\appendixname{پیوست}
+\def\indexname{نمایه}
+\def\refname{مراجع}
+\def\abstractname{چکیده}
+\def\partname{بخش}
+\def\datename{تاریخ:}
+\def\bibname{کتاب‌نامه}
+\def\chaptername{فصل}
+\def\ccname{رونوشت}
+\def\enclname{پیوست}
+\def\pagename{صفحه}
+\def\headtoname{به}
+\def\proofname{اثبات}
+\def\@harfi#1{\ifcase#1\or الف\char"200D\or ب\or پ\or ت\or ث\or
ج\or چ\or ح\or خ\or د\or ذ\or ر\or ز\or س\or ش\or ص\or ض\or ع\or غ\or
-ف\or ق\or ک\or گ\or ل\or م\or ن\or ه\or و\or ی\fi}
-
-
-\def\@harfi#1{\@character{\@@arabic#1}}
-
-\def\@numeric#1{\ifcase#1 \or یک\or دو\or سه\or چهار\or پنج\or شش\or هفت\or هشت\or نه\or ده\or یازده\or دوازده\or سیزده\or چهارده\or پانزده\or شانزده\or هفده\or هجده\or نوزده\or بیست\fi}
-\def\@adadi#1{\@numeric{\@@arabic#1}}
-
-\def\@@tartibi#1{\ifcase#1 \or اول \or دوم \or سوم \or چهارم \or پنجم \or ششم \or هفتم \or هشتم \or نهم \or دهم \or یازدهم \or دوازدهم \or سیزدهم \or چهاردهم \or پانزدهم \or شانزدهم \or هفدهم \or هجدهم \or نوزدهم \or بیستم\fi}
-\def\@tartibi#1{\@@tartibi{\@@arabic#1}}
-
-
-
-
-
-
-\let\@@text=\text
-\def\text#1{\@@text{\RL{#1}}}
-
-\def\tagform@#1{\maketag@@@{)\ignorespaces\text{#1}\unskip\@@italiccorr(}}
-\renewcommand{\eqref}[1]{\LR{\textup{\tagform@{\ref{#1}}}}}
-
-
+ف\or ق\or ک\or گ\or ل\or م\or ن\or ه\or و\or ی\else\@ctrerr\fi}
+\def\harfi#1{\expandafter\@harfi\csname c@#1\endcsname}
+\def\@adadi#1{\ifcase#1 \or یک\or دو\or سه\or چهار\or پنج\or شش\or هفت\or هشت\or نه\or ده\or یازده\or دوازده\or سیزده\or چهارده\or پانزده\or شانزده\or هفده\or هجده\or نوزده\or بیست\else\@ctrerr\fi}
+\def\adadi#1{\expandafter\@adadi\csname c@#1\endcsname}
+\def\@tartibi#1{\ifcase#1 \or اول \or دوم \or سوم \or چهارم \or پنجم \or ششم \or هفتم \or هشتم \or نهم \or دهم \or یازدهم \or دوازدهم \or سیزدهم \or چهاردهم \or پانزدهم \or شانزدهم \or هفدهم \or هجدهم \or نوزدهم \or بیستم\else\@ctrerr\fi}
+\def\tartibi#1{\expandafter\@tartibi\csname c@#1\endcsname}
+\def\SepMark#1{\gdef\@SepMark{\beginR#1\endR}}
+\SepMark{.}
\@ifclassloaded{article}{%
+\renewcommand*\l@part[2]{%
+ \ifnum \c@tocdepth >-2\relax
+ \addpenalty\@secpenalty
+ \addvspace{2.25em \@plus\p@}%
+ \setlength\@tempdima{3em}%
+ \begingroup
+ \parindent \z@ \if@RTL\leftskip\else\rightskip\fi \@pnumwidth
+ \parfillskip -\@pnumwidth
+ {\leavevmode
+ \large \bfseries #1\hfil \hb@xt@\@pnumwidth{\hss #2}}\par
+ \nobreak
+ \if@compatibility
+ \global\@nobreaktrue
+ \everypar{\global\@nobreakfalse\everypar{}}%
+ \fi
+ \endgroup
+ \fi}
+\renewcommand\thesubsection {\thesection\@SepMark\@arabic\c@subsection}
+\renewcommand\thesubsubsection{\thesubsection\@SepMark\@arabic\c@subsubsection}
+\renewcommand\theparagraph {\thesubsubsection\@SepMark\@arabic\c@paragraph}
+\renewcommand\thesubparagraph {\theparagraph\@SepMark\@arabic\c@subparagraph}
\def\@part[#1]#2{%
\ifnum \c@secnumdepth >\m@ne
\refstepcounter{part}%
@@ -455,37 +562,37 @@
\if@twoside
\def\ps@headings{%
\let\@oddfoot\@empty\let\@evenfoot\@empty
- \def\@evenhead{\sl\RL{\leftmark}\hfil\thepage}%
- \def\@oddhead{\sl\thepage\hfil\RL{\rightmark}}%
+ \def\@evenhead{\sl\beginR\leftmark\endR\hfil\thepage}%
+ \def\@oddhead{\sl\thepage\hfil\beginR\rightmark\endR}%
\let\@mkboth\markboth
\def\sectionmark##1{%
\markboth {\MakeUppercase{%
\ifnum \c@secnumdepth >\z@
\thesection\quad
\fi
- \RL{##1}}}{}}%
+ \beginR##1\endR}}{}}%
\def\subsectionmark##1{%
\markright {%
\ifnum \c@secnumdepth >\@ne
- \RL{\thesubsection\quad}
+ \beginR\thesubsection\quad\endR
\fi
- \RL{##1}}}}
+ \beginR##1\endR}}}
\else
\def\ps@headings{%
\let\@oddfoot\@empty
- \def\@oddhead{\sl\thepage\hfil\RL{\rightmark}}%
+ \def\@oddhead{\sl\thepage\hfil\beginR\rightmark\endR}%
\let\@mkboth\markboth
\def\sectionmark##1{%
\markright {\MakeUppercase{%
\ifnum \c@secnumdepth >\m@ne
- \RL{\thesection\quad}
+ \beginR\thesection\quad\endR
\fi
- \RL{##1}}}}}
+ \beginR##1\endR}}}}
\fi
\def\ps@myheadings{%
\let\@oddfoot\@empty\let\@evenfoot\@empty
- \def\@evenhead{\sl\thepage\hfil\RL{\leftmark}}%
- \def\@oddhead{\sl\RL{\rightmark}\hfil\thepage}%
+ \def\@evenhead{\sl\thepage\hfil\beginR\leftmark\endR}%
+ \def\@oddhead{\sl\beginR\rightmark\endR\hfil\thepage}%
\let\@mkboth\@gobbletwo
\let\sectionmark\@gobble
\let\subsectionmark\@gobble
@@ -501,6 +608,27 @@
\@ifclassloaded{amsart}{%
+\def\@tocline#1#2#3#4#5#6#7{\relax
+ \ifnum #1>\c@tocdepth % then omit
+ \else
+ \par \addpenalty\@secpenalty\addvspace{#2}%
+ \begingroup \hyphenpenalty\@M
+ \@ifempty{#4}{%
+ \@tempdima\csname r@tocindent\number#1\endcsname\relax
+ }{%
+ \@tempdima#4\relax
+ }%
+ \parindent\z@ \if@RTL\rightskip\else\leftskip\fi#3\relax \advance\if@RTL\rightskip\else\leftskip\fi\@tempdima\relax
+ \if@RTL\leftskip\else\rightskip\fi\@pnumwidth plus4em \parfillskip-\@pnumwidth
+ #5\leavevmode\hskip-\@tempdima #6\nobreak\relax
+ \hfil\hbox to\@pnumwidth{\@tocpagenum{#7}}\par
+ \nobreak
+ \endgroup
+ \fi}
+\renewcommand\thesubsection {\thesection\@SepMark\arabic{subsection}}
+\renewcommand\thesubsubsection {\thesubsection \@SepMark\arabic{subsubsection}}
+\renewcommand\theparagraph {\thesubsubsection\@SepMark\arabic{paragraph}}
+\renewcommand\thesubparagraph {\theparagraph\@SepMark\arabic{subparagraph}}
\def\part{\@startsection{part}{0}%
\z@{\linespacing\@plus\linespacing}{.5\linespacing}%
{\normalfont\bfseries\raggedleft}}
@@ -528,6 +656,33 @@
\@ifclassloaded{report}{%
+\renewcommand*\l@part[2]{%
+ \ifnum \c@tocdepth >-2\relax
+ \addpenalty{-\@highpenalty}%
+ \addvspace{2.25em \@plus\p@}%
+ \setlength\@tempdima{3em}%
+ \begingroup
+ \parindent \z@ \if@RTL\leftskip\else\rightskip\fi \@pnumwidth
+ \parfillskip -\@pnumwidth
+ {\leavevmode
+ \large \bfseries #1\hfil \hb@xt@\@pnumwidth{\hss #2}}\par
+ \nobreak
+ \global\@nobreaktrue
+ \everypar{\global\@nobreakfalse\everypar{}}%
+ \endgroup
+ \fi}
+\renewcommand\theequation
+ {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@equation}
+\renewcommand \thefigure
+ {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@figure}
+\renewcommand \thetable
+ {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@table}
+\renewcommand \thechapter {\@arabic\c@chapter}
+\renewcommand \thesection {\thechapter\@SepMark\@arabic\c@section}
+\renewcommand\thesubsection {\thesection\@SepMark\@arabic\c@subsection}
+\renewcommand\thesubsubsection{\thesubsection \@SepMark\@arabic\c@subsubsection}
+\renewcommand\theparagraph {\thesubsubsection\@SepMark\@arabic\c@paragraph}
+\renewcommand\thesubparagraph {\theparagraph\@SepMark\@arabic\c@subparagraph}
\def\@makechapterhead#1{%
\vspace*{50\p@}%
{\parindent \z@ \raggedleft \normalfont
@@ -570,37 +725,37 @@
\if@twoside
\def\ps@headings{%
\let\@oddfoot\@empty\let\@evenfoot\@empty
- \def\@evenhead{\sl\thepage\hfil\RL{\leftmark}}%
- \def\@oddhead{\sl\RL{\rightmark}\hfil\thepage}%
+ \def\@evenhead{\sl\thepage\hfil\beginR\leftmark\endR}%
+ \def\@oddhead{\sl\beginR\rightmark\endR\hfil\thepage}%
\let\@mkboth\markboth
\def\chaptermark##1{%
\markboth {\MakeUppercase{%
\ifnum \c@secnumdepth >\m@ne
- \RL{\@chapapp\ \thechapter. \ }%
+ \beginR\@chapapp\ \thechapter. \ \endR%
\fi
- \RL{##1}}}{}}%
+ \beginR##1\endR}}{}}%
\def\sectionmark##1{%
\markright {\MakeUppercase{%
\ifnum \c@secnumdepth >\z@
- \RL{\thesection. \ }%
+ \beginR\thesection. \ \endR%
\fi
- \RL{##1}}}}}
+ \beginR##1\endR}}}}
\else
\def\ps@headings{%
\let\@oddfoot\@empty
- \def\@oddhead{\sl\RL{\rightmark}\hfil\thepage}%
+ \def\@oddhead{\sl\beginR\rightmark\endR\hfil\thepage}%
\let\@mkboth\markboth
\def\chaptermark##1{%
\markright {\MakeUppercase{%
\ifnum \c@secnumdepth >\m@ne
- \RL{\@chapapp\ \thechapter. \ }%
+ \beginR\@chapapp\ \thechapter. \ \endR%
\fi
- \RL{##1}}}}}
+ \beginR##1\endR}}}}
\fi
\def\ps@myheadings{%
\let\@oddfoot\@empty\let\@evenfoot\@empty
- \def\@evenhead{\sl\thepage\hfil\RL{\leftmark}}%
- \def\@oddhead{\sl\RL{\rightmark}\hfil\thepage}%
+ \def\@evenhead{\sl\thepage\hfil\beginR\leftmark\endR}%
+ \def\@oddhead{\sl\beginR\rightmark\endR\hfil\thepage}%
\let\@mkboth\@gobbletwo
\let\chaptermark\@gobble
\let\sectionmark\@gobble
@@ -619,6 +774,33 @@
\@ifclassloaded{xepersian-thesis}{%
+\renewcommand*\l@part[2]{%
+ \ifnum \c@tocdepth >-2\relax
+ \addpenalty{-\@highpenalty}%
+ \addvspace{2.25em \@plus\p@}%
+ \setlength\@tempdima{3em}%
+ \begingroup
+ \parindent \z@ \if@RTL\leftskip\else\rightskip\fi \@pnumwidth
+ \parfillskip -\@pnumwidth
+ {\leavevmode
+ \large \bfseries #1\hfil \hb@xt@\@pnumwidth{\hss #2}}\par
+ \nobreak
+ \global\@nobreaktrue
+ \everypar{\global\@nobreakfalse\everypar{}}%
+ \endgroup
+ \fi}
+\renewcommand\theequation
+ {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@equation}
+\renewcommand \thefigure
+ {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@figure}
+\renewcommand \thetable
+ {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@table}
+\renewcommand \thechapter {\@arabic\c@chapter}
+\renewcommand \thesection {\thechapter\@SepMark\@arabic\c@section}
+\renewcommand\thesubsection {\thesection\@SepMark\@arabic\c@subsection}
+\renewcommand\thesubsubsection{\thesubsection \@SepMark\@arabic\c@subsubsection}
+\renewcommand\theparagraph {\thesubsubsection\@SepMark\@arabic\c@paragraph}
+\renewcommand\thesubparagraph {\theparagraph\@SepMark\@arabic\c@subparagraph}
\def\@makechapterhead#1{%
\vspace*{50\p@}%
{\parindent \z@ \raggedleft \normalfont
@@ -661,37 +843,37 @@
\if@twoside
\def\ps@headings{%
\let\@oddfoot\@empty\let\@evenfoot\@empty
- \def\@evenhead{\sl\thepage\hfil\RL{\leftmark}}%
- \def\@oddhead{\sl\RL{\rightmark}\hfil\thepage}%
+ \def\@evenhead{\sl\thepage\hfil\beginR\leftmark\endR}%
+ \def\@oddhead{\sl\beginR\rightmark\endR\hfil\thepage}%
\let\@mkboth\markboth
\def\chaptermark##1{%
\markboth {\MakeUppercase{%
\ifnum \c@secnumdepth >\m@ne
- \RL{\@chapapp\ \thechapter. \ }%
+ \beginR\@chapapp\ \thechapter. \ \endR%
\fi
- \RL{##1}}}{}}%
+ \beginR##1\endR}}{}}%
\def\sectionmark##1{%
\markright {\MakeUppercase{%
\ifnum \c@secnumdepth >\z@
- \RL{\thesection. \ }%
+ \beginR\thesection. \ \endR%
\fi
- \RL{##1}}}}}
+ \beginR##1\endR}}}}
\else
\def\ps@headings{%
\let\@oddfoot\@empty
- \def\@oddhead{\sl\RL{\rightmark}\hfil\thepage}%
+ \def\@oddhead{\sl\beginR\rightmark\endR\hfil\thepage}%
\let\@mkboth\markboth
\def\chaptermark##1{%
\markright {\MakeUppercase{%
\ifnum \c@secnumdepth >\m@ne
- \RL{\@chapapp\ \thechapter. \ }%
+ \beginR\@chapapp\ \thechapter. \ \endR%
\fi
- \RL{##1}}}}}
+ \beginR##1\endR}}}}
\fi
\def\ps@myheadings{%
\let\@oddfoot\@empty\let\@evenfoot\@empty
- \def\@evenhead{\sl\thepage\hfil\RL{\leftmark}}%
- \def\@oddhead{\sl\RL{\rightmark}\hfil\thepage}%
+ \def\@evenhead{\sl\thepage\hfil\beginR\leftmark\endR}%
+ \def\@oddhead{\sl\beginR\rightmark\endR\hfil\thepage}%
\let\@mkboth\@gobbletwo
\let\chaptermark\@gobble
\let\sectionmark\@gobble
@@ -710,6 +892,27 @@
\@ifclassloaded{amsbook}{%
+\def\@tocline#1#2#3#4#5#6#7{\relax
+ \ifnum #1>\c@tocdepth % then omit
+ \else
+ \par \addpenalty\@secpenalty\addvspace{#2}%
+ \begingroup \hyphenpenalty\@M
+ \@ifempty{#4}{%
+ \@tempdima\csname r@tocindent\number#1\endcsname\relax
+ }{%
+ \@tempdima#4\relax
+ }%
+ \parindent\z@ \if@RTL\rightskip\else\leftskip\fi#3\relax \advance\if@RTL\rightskip\else\leftskip\fi\@tempdima\relax
+ \if@RTL\leftskip\else\rightskip\fi\@pnumwidth plus4em \parfillskip-\@pnumwidth
+ #5\leavevmode\hskip-\@tempdima #6\nobreak\relax
+ \hfil\hbox to\@pnumwidth{\@tocpagenum{#7}}\par
+ \nobreak
+ \endgroup
+ \fi}
+\renewcommand\thesubsection {\thesection\@SepMark\arabic{subsection}}
+\renewcommand\thesubsubsection {\thesubsection \@SepMark\arabic{subsubsection}}
+\renewcommand\theparagraph {\thesubsubsection\@SepMark\arabic{paragraph}}
+\renewcommand\thesubparagraph {\theparagraph\@SepMark\arabic{subparagraph}}
\renewenvironment{thebibliography}[1]{%
\@bibtitlestyle
\normalfont\bibliofont\labelsep .5em\relax
@@ -827,6 +1030,33 @@
\@ifclassloaded{book}{%
+\renewcommand*\l@part[2]{%
+ \ifnum \c@tocdepth >-2\relax
+ \addpenalty{-\@highpenalty}%
+ \addvspace{2.25em \@plus\p@}%
+ \setlength\@tempdima{3em}%
+ \begingroup
+ \parindent \z@ \if@RTL\leftskip\else\rightskip\fi \@pnumwidth
+ \parfillskip -\@pnumwidth
+ {\leavevmode
+ \large \bfseries #1\hfil \hb@xt@\@pnumwidth{\hss #2}}\par
+ \nobreak
+ \global\@nobreaktrue
+ \everypar{\global\@nobreakfalse\everypar{}}%
+ \endgroup
+ \fi}
+\renewcommand\theequation
+ {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@equation}
+\renewcommand \thefigure
+ {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@figure}
+\renewcommand \thetable
+ {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@table}
+\renewcommand \thechapter {\@arabic\c@chapter}
+\renewcommand \thesection {\thechapter\@SepMark\@arabic\c@section}
+\renewcommand\thesubsection {\thesection\@SepMark\@arabic\c@subsection}
+\renewcommand\thesubsubsection{\thesubsection \@SepMark\@arabic\c@subsubsection}
+\renewcommand\theparagraph {\thesubsubsection\@SepMark\@arabic\c@paragraph}
+\renewcommand\thesubparagraph {\theparagraph\@SepMark\@arabic\c@subparagraph}
\def\@makechapterhead#1{%
\vspace*{50\p@}%
{\parindent \z@ \raggedleft \normalfont
@@ -875,7 +1105,7 @@
\renewcommand\mainmatter{%
\cleardoublepage
\@mainmattertrue
- \pagenumbering{persian}}
+ \pagenumbering{arabic}}
\renewcommand\backmatter{%
\if@openright
\cleardoublepage
@@ -887,15 +1117,15 @@
\if@twoside
\def\ps@headings{%
\let\@oddfoot\@empty\let\@evenfoot\@empty
- \def\@evenhead{\sl\RL{\rightmark}\hfil\thepage}%
- \def\@oddhead{\sl\thepage\hfil\RL{\leftmark}}%
+ \def\@evenhead{\sl\beginR\rightmark\endR\hfil\thepage}%
+ \def\@oddhead{\sl\thepage\hfil\beginR\leftmark\endR}%
\let\@mkboth\markboth
\def\chaptermark##1{%
\markboth {\MakeUppercase{%
- \RL{\@chapapp\ \thechapter.\,\,}%
+ \beginR\@chapapp\ \thechapter.\,\,\endR%
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
- \RL{##1}
+ \beginR##1\endR
\fi
\fi
}}{}}%
@@ -905,22 +1135,22 @@
}
\def\sectionmark##1{%
\markright {\MakeUppercase{%
- \RL{\thesection}\,
+ \beginR\thesection\endR\,
\ifnum \c@secnumdepth >\z@
- \RL{##1} \ %
+ \beginR##1\endR \ %
\fi
}}}}
\else
\def\ps@headings{%
\let\@oddfoot\@empty
- \def\@oddhead{\sl\thepage\hfil\RL{\rightmark}}%
+ \def\@oddhead{\sl\thepage\hfil\beginR\rightmark\endR}%
\let\@mkboth\markboth
\def\chaptermark##1{%
\markright {\MakeUppercase{%
- \RL{\@chapapp\ \thechapter. } %
+ \beginR\@chapapp\ \thechapter. \endR %
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
- \RL{##1}
+ \beginR##1\endR
\fi
\fi
}}}}
@@ -942,6 +1172,31 @@
\@ifclassloaded{refrep}{%
+\renewcommand*\l@part[2]{%
+ \ifnum \c@tocdepth >-2\relax
+ \addpenalty{-\@highpenalty}%
+ \addvspace{2.25em \@plus\p@}%
+ \begingroup
+ \parindent \z@ \if@RTL\leftskip\else\rightskip\fi \@pnumwidth
+ \parfillskip -\@pnumwidth
+ {\leavevmode
+ \large \bfseries #1\hfil \hbox to\@pnumwidth{\hss #2}}\par
+ \nobreak
+ \global\@nobreaktrue
+ \everypar{\global\@nobreakfalse\everypar{}}%
+ \endgroup
+ \fi}
+\renewcommand\theequation
+{\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@equation}
+\renewcommand\thefigure
+ {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@figure}
+\renewcommand\thetable%
+ {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@table}
+\renewcommand\thesection {\thechapter\@SepMark\@arabic\c@section}
+\renewcommand\thesubsection {\thesection\@SepMark\@arabic\c@subsection}
+\renewcommand\thesubsubsection {\thesubsection \@SepMark\@arabic\c@subsubsection}
+\renewcommand\theparagraph {\thesubsubsection\@SepMark\@arabic\c@paragraph}
+\renewcommand\thesubparagraph {\theparagraph\@SepMark\@arabic\c@subparagraph}
\renewcommand \thepart {\@tartibi\c@part}
%to make appendix numbering Persian
\renewcommand\appendix{\par
@@ -952,23 +1207,33 @@
}%end appendix
}{}
+\renewcommand{\numberwithin}[3][\arabic]{%
+ \@ifundefined{c@#2}{\@nocounterr{#2}}{%
+ \@ifundefined{c@#3}{\@nocnterr{#3}}{%
+ \@addtoreset{#2}{#3}%
+ \@xp\xdef\csname the#2\endcsname{%
+ \@xp\@nx\csname the#3\endcsname \@SepMark\@nx#1{#2}}}}%
+}
+
+\def\@thmcountersep{\@SepMark}
+
\@ifclassloaded{beamer}{%
\def\familydefault{\rmdefault}
\raggedleft
-\def\LTR{\bgroup\par\raggedright\@rlfalse}
+\def\LTR{\bgroup\par\raggedright\@RTLfalse}
\def\endLTR{\par\egroup}
-\def\RTL{\bgroup\par\raggedleft\@rltrue}
+\def\RTL{\bgroup\par\raggedleft\@RTLtrue}
\def\endRTL{\par\egroup}
-\def\roman{\bgroup\par\raggedright\@rlfalse\rmfamily}
+\def\roman{\bgroup\par\raggedright\@RTLfalse\rmfamily}
\def\endroman{\par\egroup}
-\def\persian{\bgroup\par\raggedleft\@rltrue\persianfont}
+\def\persian{\bgroup\par\raggedleft\@RTLtrue\persianfont}
\def\endpersian{\par\egroup}
\long\def\beamer@@frametitle[#1]#2{%
\beamer@ifempty{#2}{}{%
- \gdef\insertframetitle{\raggedleft\rightskip=2em{\RL{#2}\ifnum\beamer@autobreakcount>0\relax{}\space\usebeamertemplate*{frametitle continuation}\fi}}%
- \gdef\beamer@frametitle{\RL{#2}}%
- \gdef\beamer@shortframetitle{\RL{#1}}%
+ \gdef\insertframetitle{\raggedleft\rightskip=2em{\beginR#2\endR\ifnum\beamer@autobreakcount>0\relax{}\space\usebeamertemplate*{frametitle continuation}\fi}}%
+ \gdef\beamer@frametitle{\beginR#2\endR}%
+ \gdef\beamer@shortframetitle{\beginR#1\endR}%
}%
}
\def\@thm#1#2#3{%
@@ -989,7 +1254,7 @@
\expandafter\def\expandafter\inserttheoremnumber\expandafter{ \csname the#2\endcsname}
\fi
\beamer@begintheorem%
-\raggedleft\@rltrue
+\raggedleft\@RTLtrue
}
\ifbeamer@countsect
\newtheorem{قضیه}{\raggedleft قضیه}[section]
@@ -998,7 +1263,7 @@
\fi
\newtheorem{نتیجه}[theorem]{\raggedleft نتیجه}
\newtheorem{حقیقت}[theorem]{\raggedleft حقیقت}
- \newtheorem{لما}[theorem]{\raggedleft لما}
+ \newtheorem{لم}[theorem]{\raggedleft لم}
\newtheorem{مسئله}[theorem]{\raggedleft مسئله}
\newtheorem{پاسخ}[theorem]{\raggedleft پاسخ}
\theoremstyle{definition}
@@ -1011,13 +1276,13 @@
\par
\def\insertproofname{#1\@addpunct{}}%
\pushQED{\qed}
- \usebeamertemplate{proof begin}\@rltrue#2}
+ \usebeamertemplate{proof begin}\@RTLtrue#2}
{\popQED\usebeamertemplate{proof end}}
\newenvironment<>{بلوک}[1]{%
\begin{actionenv}#2%
\def\insertblocktitle{\raggedleft#1}%
\par%
- \usebeamertemplate{block begin}\raggedleft\@rltrue}
+ \usebeamertemplate{block begin}\raggedleft\@RTLtrue}
{\par%
\usebeamertemplate{block end}%
\end{actionenv}}
@@ -1027,7 +1292,7 @@
\par%
\mode<presentation>{%\usebeamerfont{block}%
\setbeamercolor{local structure}{parent=alerted text}}%
- \usebeamertemplate{block alerted begin}\raggedleft\@rltrue}
+ \usebeamertemplate{block alerted begin}\raggedleft\@RTLtrue}
{\par%
\usebeamertemplate{block alerted end}%
\end{actionenv}}
@@ -1037,10 +1302,23 @@
\par%
\mode<presentation>{%\usebeamerfont{block}%
\setbeamercolor{local structure}{parent=example text}}%
- \usebeamertemplate{block example begin}\raggedleft\@rltrue}
+ \usebeamertemplate{block example begin}\raggedleft\@RTLtrue}
{\par%
\usebeamertemplate{block example end}%
\end{actionenv}}
+\def\@listi{\if@RTL\rightmargin\leftmargini\else\leftmargin\leftmargini\fi
+ \topsep 3\p@ \@plus2\p@ \@minus2.5\p@
+ \parsep 0\p@
+ \itemsep3\p@ \@plus2\p@ \@minus3\p@}
+\let\@listI\@listi
+\def\@listii{\if@RTL\rightmargin\leftmarginii\else\leftmargin\leftmarginii\fi
+ \topsep 2\p@ \@plus1\p@ \@minus2\p@
+ \parsep 0\p@ \@plus\p@
+ \itemsep \parsep}
+\def\@listiii{\if@RTL\rightmargin\leftmarginiii\else\leftmargin\leftmarginiii\fi
+ \topsep 2\p@ \@plus1\p@ \@minus2\p@
+ \parsep 0\p@ \@plus\p@
+ \itemsep \parsep}
\def\beamer@enum@{%
\beamer@computepref\@itemdepth% sets \beameritemnestingprefix
\usebeamerfont{itemize/enumerate \beameritemnestingprefix body}%
@@ -1054,7 +1332,7 @@
\usebeamerfont*{enumerate \beameritemnestingprefix item}%
\usebeamercolor[fg]{enumerate \beameritemnestingprefix item}##1}}}}}%
\beamer@cramped%
- \raggedleft\rightskip=2em%
+ \raggedleft%
\beamer@firstlineitemizeunskip%
}
\renewcommand{\itemize}[1][]{%
@@ -1077,7 +1355,7 @@
}
\fi%
\beamer@cramped%
- \raggedleft\rightskip=2em%
+ \raggedleft%
\beamer@firstlineitemizeunskip%
}
\def\@@description{%
@@ -1089,7 +1367,7 @@
\raggedleft\rightskip=6em
\beamer@firstlineitemizeunskip%
}
-\AtBeginDocument{\@rlfalse}
+\AtBeginDocument{\@RTLfalse}
\renewenvironment{beamer@frameslide}{%
\ifbeamer@autobreak\else%
\ifx\beamer@againname\@empty%
@@ -1118,7 +1396,7 @@
\gdef\beamer@framesubtitle{}%
\let\beamer@startcomment=\beamer@startcommentinframe%
% Start slide:
- \beamer@framenotesbegin\@rltrue%
+ \beamer@framenotesbegin\@RTLtrue%
\global\setbox\beamer@framebox=\vbox\bgroup%
\beamer@inframetrue%
\let\frame=\framelatex% inside frames, use LaTeX's \frame command
@@ -1192,20 +1470,20 @@
\beamer@framenotesend%
\box\beamer@framebox}
\long\def\beamer@title[#1]#2{%
- \def\inserttitle{\RL{#2}}%
- \def\beamer@shorttitle{\RL{#1}}%
+ \def\inserttitle{\beginR#2\endR}%
+ \def\beamer@shorttitle{\beginR#1\endR}%
}
\long\def\beamer@subtitle[#1]#2{%
- \def\insertsubtitle{\RL{#2}}%
- \def\beamer@shortsubtitle{\RL{#1}}%
+ \def\insertsubtitle{\beginR#2\endR}%
+ \def\beamer@shortsubtitle{\beginR#1\endR}%
}
\long\def\beamer@date[#1]#2{%
- \def\insertdate{\RL{#2}}%
- \def\beamer@shortdate{\RL{#1}}%
+ \def\insertdate{\beginR#2\endR}%
+ \def\beamer@shortdate{\beginR#1\endR}%
}
\long\def\beamer@author[#1]#2{%
- \def\insertauthor{\def\inst{\beamer@insttitle}\def\and{\beamer@andtitle}\RL{#2}}%
- \def\beamer@shortauthor{\RL{#1}}%
+ \def\insertauthor{\def\inst{\beamer@insttitle}\def\and{\beamer@andtitle}\beginR#2\endR}%
+ \def\beamer@shortauthor{\beginR#1\endR}%
\ifbeamer@autopdfinfo%
\def\beamer@andstripped{}%
\beamer@stripands#2 \and\relax
@@ -1213,13 +1491,13 @@
\fi%
}
\long\def\beamer@institute[#1]#2{%
- \def\beamer@temp{\RL{#2}}%
+ \def\beamer@temp{\beginR#2\endR}%
\ifx\beamer@temp\@empty
\def\insertinstitute{}
\else
- \def\insertinstitute{\def\inst{\beamer@instinst}\def\and{\beamer@andinst}\RL{#2}}%
+ \def\insertinstitute{\def\inst{\beamer@instinst}\def\and{\beamer@andinst}\beginR#2\endR}%
\fi
- \def\beamer@shortinstitute{\RL{#1}}}
+ \def\beamer@shortinstitute{\beginR#1\endR}}
\renewenvironment{thebibliography}[1]
{%\leavevmode\unskip%
\list{\@biblabel{\@arabic\c@enumiv}}%
@@ -1241,9 +1519,9 @@
{\def\@noitemerr
{\@latex@warning{Empty `thebibliography' environment}}%
\ifhmode\unskip\fi\endlist}
-\long\def\beamer@@@section#1{\beamer@section[\RL{#1}]{#1}}
-\def\beamer@@@subsection#1{\beamer@subsection[\RL{#1}]{#1}}
-\def\beamer@@@subsubsection#1{\beamer@subsubsection[\RL{#1}]{#1}}
+\long\def\beamer@@@section#1{\beamer@section[\beginR#1\endR]{#1}}
+\def\beamer@@@subsection#1{\beamer@subsection[\beginR#1\endR]{#1}}
+\def\beamer@@@subsubsection#1{\beamer@subsubsection[\beginR#1\endR]{#1}}
\long\def\beamer@subsectionintoc#1#2#3#4#5#6{%
\ifnum\c@tocdepth>1%
\ifnum#5=\beamer@showpartnumber%
@@ -1257,7 +1535,7 @@
\advance\beamer@tempcount by\beamer@sectionadjust%
\edef\inserttocsectionnumber{\the\beamer@tempcount}%
\def\inserttocsubsectionnumber{#2}%
- \def\inserttocsubsection{\rightskip=1.5em\hyperlink{Navigation#4}{\RL{#3}\hfill}}%
+ \def\inserttocsubsection{\rightskip=1.5em\hyperlink{Navigation#4}{\beginR#3\endR\hfill}}%
\beamer@tocifnothide{\ifnum\c@section=#1\beamer@toc@oss\else\beamer@toc@ooss\fi}%
{%
\def\beamer@breakhere{\\}%
@@ -1284,7 +1562,7 @@
\edef\inserttocsectionnumber{\the\beamer@tempcount}%
\def\inserttocsubsectionnumber{#3}%
\def\inserttocsubsubsectionnumber{#4}%
- \def\inserttocsubsubsection{\rightskip=3em\hyperlink{Navigation#5}{\RL{#7}\hfill}}%
+ \def\inserttocsubsubsection{\rightskip=3em\hyperlink{Navigation#5}{\beginR#7\endR\hfill}}%
\beamer@tocifnothide{\ifnum\c@section=#2\beamer@toc@oss\else\beamer@toc@ooss\fi}%
{%
\def\beamer@breakhere{\\}%
@@ -1297,120 +1575,20 @@
\beamer@todo%
\fi\fi%
}
-}{}
-
-
-
-
-
-
-
-
-\def\rl@outputdblcolumn{%
- \if@firstcolumn
- \global \@firstcolumnfalse
- \global \setbox\@leftcolumn \box\@outputbox
- \else
- \global \@firstcolumntrue
- \setbox\@outputbox \vbox {\hb@xt@\textwidth {%
- \hskip\columnwidth%
- \hfil\vrule\@width\columnseprule\hfil
- \hb@xt@\columnwidth {%
- \box\@leftcolumn \hss}%
- \hb@xt@\columnwidth {%
- \hskip-\textwidth%
- \box\@outputbox \hss}%
- \hskip\columnsep%
- \hskip\columnwidth}}%
- \@combinedblfloats
- \@outputpage
- \begingroup
- \@dblfloatplacement
- \@startdblcolumn
- \@whilesw\if@fcolmade \fi
- {\@outputpage
- \@startdblcolumn}%
- \endgroup
- \fi}
-
-\def\lr@outputdblcolumn{%
- \if@firstcolumn
- \global \@firstcolumnfalse
- \global \setbox\@leftcolumn \box\@outputbox
+\long\def\beamer@makecaption#1#2{%
+ \def\insertcaptionname{\csname#1name\endcsname}%
+ \def\insertcaptionnumber{\csname the#1\endcsname}%
+ \def\insertcaption{#2}%
+ \nobreak\vskip\abovecaptionskip\nobreak
+ \sbox\@tempboxa{\usebeamertemplate**{caption}}%
+ \ifdim \wd\@tempboxa >\hsize
+ \usebeamertemplate**{caption}\par
\else
- \global \@firstcolumntrue
- \setbox\@outputbox \vbox {%
- \hb@xt@\textwidth {%
- \hb@xt@\columnwidth {%
- \box\@leftcolumn \hss}%
- \hfil
- {\normalcolor\vrule \@width\columnseprule}%
- \hfil
- \hb@xt@\columnwidth {%
- \box\@outputbox \hss}%
- }%
- }%
- \@combinedblfloats
- \@outputpage
- \begingroup
- \@dblfloatplacement
- \@startdblcolumn
- \@whilesw\if@fcolmade \fi
- {\@outputpage
- \@startdblcolumn}%
- \endgroup
+ \global \@minipagefalse
+ \hb@xt@\hsize{\if@RTL\beginR\fi\hfil\box\@tempboxa\hfil\if@RTL\endR\fi}%
\fi
-}
-\newcommand{\rldblcolumn}{\renewcommand{\@outputdblcol}{\rl@outputdblcolumn}}
-\newcommand{\lrdblcolumn}{\renewcommand{\@outputdblcol}{\lr@outputdblcolumn}}
-%set the default direction of the twocolumn texts to Right-to-Left
-\rldblcolumn
-
-
-
-
-
-\newif\if@tabsw
-\global\@tabswfalse
-\def\@tabular{\if@rl\global\@tabswtrue\fi
- \leavevmode \hbox \bgroup \if@tabsw\beginR\normalfont \fi
- $\let\@acol\@tabacol
- \let\@classz\@tabclassz
- \let\@classiv\@tabclassiv \let\\\@tabularcr\@tabarray}
-\def\endtabular{\crcr\egroup\if@tabsw\egroup\endR\egroup\fi
- \egroup $\if@tabsw\endR\fi \egroup
- \global\@tabswfalse}
-\expandafter \let \csname endtabular*\endcsname = \endtabular
-
-\def\@array[#1]#2{\setbox\@arstrutbox=\hbox{\vrule
- height\arraystretch \ht\strutbox
- depth\arraystretch \dp\strutbox
- width\z@}\@mkpream{#2}\edef\@preamble{%
-\halign \noexpand\@halignto
-\bgroup \tabskip\z@ \@arstrut \@preamble \tabskip\z@ \cr}%
-\let\@startpbox\@@startpbox \let\@endpbox\@@endpbox
-\if #1t\vtop \else \if#1b\vbox \else \vcenter \fi\fi
-\bgroup \let\par\relax
-\let\@sharp##\let\protect\relax \lineskip\z@\baselineskip\z@
-\if@tabsw\hbox\bgroup\beginR\vbox\bgroup\fi
-\@preamble}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ \nobreak\vskip\belowcaptionskip\nobreak}
+}{}
\providecommand*{\xpg@warning}[1]{%
\PackageWarning{XePersian}%
@@ -1437,7 +1615,7 @@
}
\def\abjad@zero{}
\def\abj@num@i#1{%
- \ifcase#1\or ا\or ب\or ج\char"200D\or د%
+ \ifcase#1\or الف\or ب\or ج\or د%
\or ه\char"200D\or و\or ز\or ح\or ط\fi
\ifnum#1=\z@\abjad@zero\fi}
\def\abj@num@ii#1{%
@@ -1460,14 +1638,6 @@
-\def\underline#1{%
- \relax
- \ifmmode\@@@underline{#1}%
- \else
-\if@rl $\@@@underline{\hbox{\RL{#1}}}\m@th$\relax
-\else
-$\@@@underline{\hbox{#1}}\m@th$\relax\fi\fi}
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -1589,7 +1759,7 @@ $\@@@underline{\hbox{#1}}\m@th$\relax\fi\fi}
\bgroup
\footnotemarkLR%
\renewcommand{\thefootnote}{\if@RomanFootNum\rmfamily{\@arabic\c@footnote}\else\@arabic\c@footnote\fi}%
-\@rl@footnotefalse\footnotetext{\rmfamily#1}%
+\@RTLfalse\footnotetext{\rmfamily#1}%
\egroup
}
\@RomanFootNumfalse