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.sty178
1 files changed, 118 insertions, 60 deletions
diff --git a/Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty b/Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty
index f3651751538..1c608d4bc46 100644
--- a/Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty
+++ b/Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty
@@ -1,20 +1,27 @@
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{xepersian}[2008/09/17 v0.161111111
- Typesetting Persian with XeTeX]
+\ProvidesPackage{xepersian}[2008/09/27 v0.162
+ Persian typesetting in XeLaTeX]
+
+\begingroup
+ \def\notXeLaTeXformat{%
+ \@latex@error{*** this package currently works only with XeLaTeX ***^^J
+ You are not using XeLaTeX, so we are exiting cleanly!^^J
+ Continuing may lead to 'unavailable font metrics' errors!^^J}\@ehc
+ \endgroup\endinput}
+\expandafter\ifx\csname XeTeXpicfile\endcsname\relax\expandafter\notXeLaTeXformat\fi
+\endgroup
+
\RequirePackage{graphicx}
\RequirePackage{amssymb}
\RequirePackage{amsmath}
\RequirePackage{amsthm}
-\RequirePackage{fontspec}
+\RequirePackage[quiet]{fontspec}
\RequirePackage{bidi}
\RequirePackage{xltxtra}
\RequirePackage{xunicode}
\RequirePackage{etoolbox}
-\RequirePackage{persianpoem,fmultico}
-\AtBeginDocument{\ifdefined\farsifont\relax\else%
-\PackageWarning{XePersian}{\string\farsifont\ is not defined! XePersian will try to load ``XB Zar''}%
-\newfontfamily\farsifont[Script=Arabic,Scale=1.2,Mapping=parsidigits]{XB Zar}\fi
-}%
+\RequirePackage{xepersian-mathsdigitspec}
+
\def\ps@plain{\ps@empty
\def\@oddfoot{\hfil\farsifont\thepage\hfil}%
@@ -22,39 +29,7 @@
\let\@oddhead\@empty\let\@evenhead\@empty
}
-%to make the digits in math formula persian
-\def\setparsimathsdigitsfont#1{
-\font\tenrgm="#1" at 12pt
-\font\sevrgm="#1" at 10pt
-\font\fivrgm="#1" at 7pt
-\newfam\fardig
-\textfont\fardig=\tenrgm
-\scriptfont\fardig=\sevrgm
-\scriptscriptfont\fardig=\fivrgm
- \XeTeXmathcode`0="7 \fardig "06F0%
- \XeTeXmathcode`1="7 \fardig "06F1%
- \XeTeXmathcode`2="7 \fardig "06F2%
- \XeTeXmathcode`3="7 \fardig "06F3%
- \XeTeXmathcode`4="7 \fardig "06F4%
- \XeTeXmathcode`5="7 \fardig "06F5%
- \XeTeXmathcode`6="7 \fardig "06F6%
- \XeTeXmathcode`7="7 \fardig "06F7%
- \XeTeXmathcode`8="7 \fardig "06F8%
- \XeTeXmathcode`9="7 \fardig "06F9%
- \XeTeXmathcode`.="7 \fardig "066B%decimal point
-
- \XeTeXmathcode`٫="7 \fardig "066B%decimal point
- \XeTeXmathcode`۰="7 \fardig "06F0%
- \XeTeXmathcode`۱="7 \fardig "06F1%
- \XeTeXmathcode`۲="7 \fardig "06F2%
- \XeTeXmathcode`۳="7 \fardig "06F3%
- \XeTeXmathcode`۴="7 \fardig "06F4%
- \XeTeXmathcode`۵="7 \fardig "06F5%
- \XeTeXmathcode`۶="7 \fardig "06F6%
- \XeTeXmathcode`۷="7 \fardig "06F7%
- \XeTeXmathcode`۸="7 \fardig "06F8%
- \XeTeXmathcode`۹="7 \fardig "06F9%
-}
+
\AtBeginDocument{\setRL\farsifont\addfontfeature{Mapping=parsidigits}}
@@ -285,7 +260,24 @@
\def\@oddfoot{\hfil\rl\thepage\hfil}%
\let\@evenfoot\@oddfoot
}
-
+\renewenvironment{thebibliography}[1]
+ {\section*{\refname}%
+ \@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}%
+ \list{\@biblabel{\@arabic\c@enumiv}}%
+ {\settowidth\labelwidth{\@biblabel{#1}}%
+ \rightmargin\labelwidth \advance\rightmargin\labelsep
+ \@openbib@code
+ \usecounter{enumiv}%
+ \let\p@enumiv\@empty
+ \renewcommand\theenumiv{\@arabic\c@enumiv}}%
+ \sloppy
+ \clubpenalty4000
+ \@clubpenalty \clubpenalty
+ \widowpenalty4000%
+ \sfcode`\.\@m}
+ {\def\@noitemerr
+ {\@latex@warning{Empty `thebibliography' environment}}%
+ \endlist}
\if@twoside
\def\ps@headings{%
\let\@oddfoot\@empty\let\@evenfoot\@empty
@@ -333,8 +325,23 @@
\gdef\thesection{\@harfi\c@section}}
}{}
\@ifclassloaded{amsart}{%
-\def\l@section{\@tocline{1}{0pt}{.5pc}{2.7pc}{}}
-\def\l@subsection{\@tocline{2}{0pt}{.5pc}{2.7pc}{}}
+\let\oldleftskip=\leftskip
+\let\leftskip=\rightskip
+\let\rightskip=\oldleftskip
+\renewenvironment{thebibliography}[1]{%
+ \@bibtitlestyle
+ \normalfont\bibliofont\labelsep .5em\relax
+ \renewcommand\theenumiv{\arabic{enumiv}}\let\p@enumiv\@empty
+ \list{\@biblabel{\theenumiv}}{\settowidth\labelwidth{\@biblabel{#1}}%
+ \leftmargin\labelwidth \advance\leftmargin\labelsep
+ \rightmargin\labelwidth \advance\rightmargin\labelsep
+ \usecounter{enumiv}}%
+ \sloppy \clubpenalty\@M \widowpenalty\clubpenalty
+ \sfcode`\.=\@m
+}{%
+ \def\@noitemerr{\@latex@warning{Empty `thebibliography' environment}}%
+ \endlist
+}
\renewcommand{\datename}{\rl{تاریخ:}}
\renewcommand{\refname}{مراجع}
\renewcommand{\abstractname}{چکیده}
@@ -344,7 +351,25 @@
\gdef\thesection{\@harfi\c@section}}
}{}
\@ifclassloaded{report}{%
-
+\renewenvironment{thebibliography}[1]
+ {\chapter*{\bibname}%
+ \@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}%
+ \list{\@biblabel{\@arabic\c@enumiv}}%
+ {\settowidth\labelwidth{\@biblabel{#1}}%
+ \rightmargin\labelwidth
+ \advance\rightmargin\labelsep
+ \@openbib@code
+ \usecounter{enumiv}%
+ \let\p@enumiv\@empty
+ \renewcommand\theenumiv{\@arabic\c@enumiv}}%
+ \sloppy
+ \clubpenalty4000
+ \@clubpenalty \clubpenalty
+ \widowpenalty4000%
+ \sfcode`\.\@m}
+ {\def\@noitemerr
+ {\@latex@warning{Empty `thebibliography' environment}}%
+ \endlist}
\if@twoside
\def\ps@headings{%
\let\@oddfoot\@empty\let\@evenfoot\@empty
@@ -397,9 +422,25 @@
}%end appendix
}{}
\@ifclassloaded{amsbook}{%
-\def\l@section{\@tocline{1}{0pt}{.5pc}{2.7pc}{}}
+\renewenvironment{thebibliography}[1]{%
+ \@bibtitlestyle
+ \normalfont\bibliofont\labelsep .5em\relax
+ \renewcommand\theenumiv{\arabic{enumiv}}\let\p@enumiv\@empty
+ \list{\@biblabel{\theenumiv}}{\settowidth\labelwidth{\@biblabel{#1}}%
+ \rightmargin\labelwidth \advance\rightmargin\labelsep
+ \leftmargin\labelwidth \advance\leftmargin\labelsep
+ \usecounter{enumiv}}%
+ \sloppy \clubpenalty\@M \widowpenalty\clubpenalty
+ \sfcode`\.=\@m
+}{%
+ \def\@noitemerr{\@latex@warning{Empty `thebibliography' environment}}%
+ \endlist
+}
+\let\oldleftskip=\leftskip
+\let\leftskip=\rightskip
+\let\rightskip=\oldleftskip
\def\frontmatter{\cleardoublepage\pagenumbering{harfi}}
-\renewcommand{\bibname}{کتاب‌نامه}
+\renewcommand{\bibname}{کتاب‌نامه }
\renewcommand{\chaptername}{فصل}
\renewcommand{\partname}{بخش}
%to make appendix numbering farsi
@@ -412,7 +453,7 @@
}{}
\@ifclassloaded{bookest}{%
\NoHyper
-\renewcommand{\bibname}{کتاب‌نامه}
+\renewcommand{\bibname}{کتاب‌نامه }
\renewcommand{\chaptername}{فصل}
\renewcommand{\partname}{بخش}
%to make appendix numbering farsi
@@ -424,6 +465,25 @@
}%end appendix
}{}
\@ifclassloaded{book}{%
+\renewenvironment{thebibliography}[1]
+ {\chapter*{\bibname}%
+ \@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}%
+ \list{\@biblabel{\@arabic\c@enumiv}}%
+ {\settowidth\labelwidth{\@biblabel{#1}}%
+ \rightmargin\labelwidth
+ \advance\rightmargin\labelsep
+ \@openbib@code
+ \usecounter{enumiv}%
+ \let\p@enumiv\@empty
+ \renewcommand\theenumiv{\@arabic\c@enumiv}}%
+ \sloppy
+ \clubpenalty4000
+ \@clubpenalty \clubpenalty
+ \widowpenalty4000%
+ \sfcode`\.\@m}
+ {\def\@noitemerr
+ {\@latex@warning{Empty `thebibliography' environment}}%
+ \endlist}
\renewcommand\frontmatter{%
\cleardoublepage
\@mainmatterfalse
@@ -484,7 +544,7 @@
\fi
\pagestyle{headings}
-\renewcommand{\bibname}{کتاب‌نامه}
+\renewcommand{\bibname}{کتاب‌نامه }
\renewcommand{\chaptername}{فصل}
\renewcommand{\partname}{بخش}
%to make appendix numbering farsi
@@ -496,7 +556,7 @@
}%end appendix
}{}
\@ifclassloaded{refrep}{%
-\renewcommand{\bibname}{کتاب‌نامه}
+\renewcommand{\bibname}{کتاب‌نامه }
\renewcommand{\chaptername}{فصل}
\renewcommand{\partname}{بخش}
%to make appendix numbering farsi
@@ -511,7 +571,7 @@
%We redefine arabic counter style
-\def\@@number#1{\ifmmode\else\beginL\fi{#1}\ifmmode\else\endL\fi}
+\def\@@number#1{\ifmmode\else\beginL\fi{\farsifont #1}\ifmmode\else\endL\fi}
\def\@@latin#1{\@@number{{\@fromrl#1}}}
\def\@number{\protect\@@number}
\def\@latin{\protect\@@latin}
@@ -560,7 +620,7 @@
%a command to put a footnote from left to right
%while in a right to left context
-\newcommand{\Footnote}[1]{%
+\providerobustcmd{\Footnote}[1]{%
\bgroup% To make the scope of the change local
\footnotemark%
\renewcommand{\thefootnote}{\arabic{footnote}}%
@@ -663,20 +723,18 @@
\renewcommand{\eqref}[1]{(\ref{#1})}
%To fix equation numbers. taken from amsmath
-{\renewenvironment{equation}{%
- \unsetRL
+\renewenvironment{equation}{%
+\par\unsetRL
\incr@eqnum
\mathdisplay@push
\st@rredfalse \global\@eqnswtrue
\mathdisplay{equation}%
-\setRL
}{%
-\unsetRL
\endmathdisplay{equation}%
\mathdisplay@pop
\ignorespacesafterend
-\setRL
-}}
+\par\setRL\noindent
+}
%almost taken verbatim from polyglossia for making abjad numbering in enumerate environment
@@ -737,6 +795,6 @@
\small
\@starttoc{toc}%
\end{multicols}}
-
-
+\def\rcases#1{\left.\vcenter{\normalbaselines\m@th
+ \ialign{$##\hfil$&\quad{##}\hfil\crcr#1\crcr}}\,\right\}}
\endinput