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.sty185
1 files changed, 129 insertions, 56 deletions
diff --git a/Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty b/Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty
index 25199a6f41e..e3bad8a76dc 100644
--- a/Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty
+++ b/Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty
@@ -1,68 +1,61 @@
%%
%% This is file `xepersian.sty',
-%% generated with the docstrip utility.
-%%
-%% The original source files were:
-%%
-%% xepersian.dtx (with options: `xepersian.sty')
+
%%
%% __________________________________
-%% Copyright © 2008-2009 Vafa Khalighi
+%% Copyright © 2008-2010 Vafa Khalighi
%%
%% License information appended.
%%
%%
\NeedsTeXFormat{LaTeX2e}
-\def\xepersianversion{v1.0.3}
-\def\xepersianrevision{revision 93}
-\def\xepersiandate{2009/08/09}
+\def\xepersianversion{v1.0.4}
+\def\xepersianrevision{revision 153}
+\def\xepersiandate{2010/03/01}
\ProvidesPackage{xepersian}[\xepersiandate\space \xepersianversion\space <\xepersianrevision>
Persian typesetting in XeLaTeX]
-\DeclareOption{Kashida}{\input{kashida-xepersian.def}}
-\DeclareOption{localise}{\input{localise-xepersian.def}}
-\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{bidi}}
-\ProcessOptions\relax
-\newcommand\xepersian@isloaded[2][]{
- \expandafter\ifx\csname if@xepersian@#2loaded@\endcsname\relax
- \expandafter\newif\csname if@xepersian@#2loaded@\endcsname
- \fi
- \@ifpackageloaded{#2}
- {\csname @xepersian@#2loaded@true\endcsname #1}
- {\csname @xepersian@#2loaded@false\endcsname}}
-\xepersian@isloaded{xunicode}
-\AtBeginDocument{
- \if@xepersian@xunicodeloaded@
- \xepersian@isloaded[\PackageError{xepersian}{Oops! you have loaded package xunicode before xepersian package. Please load package xunicode after xepersian package, and then try to run xelatex on your document again}{}]{xunicode}
- \fi%
-}
-\AtBeginDocument{\ifdefined\persianfont\relax\else%
-\PackageError{xepersian}{Oops! you have not specified any font for the main text of the document. Please specify a font for the main text of the document by using \settextfont\space CS, and then try to run xelatex on your document again}%
-\fi}
-\AtBeginDocument{\ifdefined\latinfont\relax\else%
-\PackageError{xepersian}{Oops! you have not specified any font for the Latin texts of the document. Please specify a font for the Latin texts of the document by using \setlatintextfont\space CS, and then try to run xelatex on your document again}%
-\fi}
-\AtBeginDocument{\ifdefined\decimalseparator\relax\else%
-\PackageWarning{xepersian}{“You have not specified any font for the digits in maths mode and so the digits in maths mode will appear Latin. If you would like to have Persian digits in maths mode, then please specify a font for the digits in maths mode by using \setdigitfont\space CS, and then try to run xelatex on your document again”}%
-\fi}
-\RequirePackage[RTLdocument]{bidi}
\RequirePackage{fontspec}
\RequirePackage{xepersian-persiancal}
\RequirePackage{xepersian-mathsdigitspec}
\RequirePackage{etoolbox}
-\AtBeginDocument{\special{pdf: docinfo <<
-/Creator (X∃Persian \xepersianversion\space <\xepersianrevision> Copyright © 2008-2009 Vafa Khalighi)
+\RequirePackage[RTLdocument]{bidi}
+\g@addto@macro\document{%
+\special{pdf: docinfo <<
+/Creator (X∃Persian \xepersianversion\space <\xepersianrevision> Copyright © 2008-2010 Vafa Khalighi)
>>}}
+\edef\xepersianinfo{%
+xepersian package (Persian for LaTeX over XeTeX)^^J
+Description: The package supports Persian^^J
+typesetting, using fonts provided in the distribution.^^J
+Copyright © 2008-2010 Vafa Khalighi^^J
+\xepersianversion, <\xepersianrevision>, \xepersiandate^^J
+License: LaTeX Project Public License, version 1.3c or higher (your choice)^^J
+Home: http://xepersian.berlios.de^^J
+Location on CTAN: /macros/xetex/latex/xepersian}
+\typeout{\xepersianinfo}
+\edef\xepersian@everyjob{\the\everyjob}
+\everyjob{\xepersian@everyjob\typeout{\xepersianinfo}}
\gdef\@latex@error#1#2{%
\GenericError{%
\space\space\space\@spaces\@spaces\@spaces
}{%
XePersian Error: #1%
}{%
- Oops! either you have done something wrong or it is a xepersian bug. 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.%
+ Oops! either you have done something wrong or it is a xepersian bug. Please first produce a similar file without using XePersian package and then compile it with xelatex, if you got the same error, then either you have been certainly doing something wrong or it is a LaTeX bug, 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}}
+\AtBeginDocument{\ifdefined\persianfont\relax\else%
+\PackageError{xepersian}{Oops! you have not specified any font for the main text of the document. Please specify a font for the main text of the document by using \settextfont\space CS, and then try to run xelatex on your document again}%
+\fi}
+\AtBeginDocument{\ifdefined\latinfont\relax\else%
+\PackageInfo{xepersian}{“You have not specified any font for the Latin texts of the document and so the default TeX fonts will be used for the Latin texts of the document. If you would like to have any other font as the font of the Latin texts, then please specify a font for the Latin texts of the document by using \setlatintextfont\space CS, and then try to run xelatex on your document again”}%
+\setlatintextfont[ExternalLocation,BoldFont={lmroman10-bold},BoldItalicFont={lmroman10-bolditalic},ItalicFont={lmroman10-italic},SmallCapsFont={lmromancaps10-regular}]{lmroman10-regular}
+\fi}
+\AtBeginDocument{\ifdefined\decimalseparator\relax\else%
+\PackageInfo{xepersian}{“You have not specified any font for the digits in maths mode and so the digits in maths mode will appear Latin. If you would like to have Persian digits in maths mode, then please specify a font for the digits in maths mode by using \setdigitfont\space CS, and then try to run xelatex on your document again”}%
+\fi}
\def\prq{«}
\def\plq{»}
\newfontscript{Persian}{arab}
@@ -78,6 +71,8 @@ Persian typesetting in XeLaTeX]
\newcommand*\setlatintextfont[2][]{%
\newfontfamily\latinfont[Mapping=tex-text,#1]{#2}
}
+\let\setlatinsansfont\setsansfont
+\let\setlatinmonofont\setmonofont
\newcommand*\defpersianfont[1]{%
\@ifnextchar[{\defpersianfont@i#1}{\defpersianfont@i#1[]}}
\def\defpersianfont@i#1[#2]#3{%
@@ -96,6 +91,7 @@ Persian typesetting in XeLaTeX]
\@tempa}
\newcommand\persiansfdefault{}
\newcommand\persianttdefault{}
+\newcommand\iranicdefault{}
\newcommand\navardefault{}
\newcommand\pookdefault{}
\newcommand\sayehdefault{}
@@ -105,6 +101,9 @@ Persian typesetting in XeLaTeX]
\DeclareRobustCommand\persianttfamily
{\not@math@alphabet\persianttfamily\mathpersiantt
\fontfamily\persianttdefault\selectfont}
+\DeclareRobustCommand\iranicfamily
+ {\not@math@alphabet\iranicfamily\mathiranic
+ \fontfamily\iranicdefault\selectfont}
\DeclareRobustCommand\navarfamily
{\not@math@alphabet\navarfamily\mathnavar
\fontfamily\navardefault\selectfont}
@@ -116,6 +115,7 @@ Persian typesetting in XeLaTeX]
\fontfamily\sayehdefault\selectfont}
\DeclareTextFontCommand{\textpersiansf}{\persiansffamily}
\DeclareTextFontCommand{\textpersiantt}{\persianttfamily}
+\DeclareTextFontCommand{\textiranic}{\iranicfamily}
\DeclareTextFontCommand{\textnavar}{\navarfamily}
\DeclareTextFontCommand{\textpook}{\pookfamily}
\DeclareTextFontCommand{\textsayeh}{\sayehfamily}
@@ -139,32 +139,99 @@ Persian typesetting in XeLaTeX]
\zf@fontspec{Script=Persian,Mapping=parsidigits,#1}{#2}%
\let\sayehdefault\zf@family
\normalfont}
+\newcommand*\setiranicfont[2][]{%
+ \zf@fontspec{Script=Persian,Mapping=parsidigits,#1}{#2}%
+ \let\iranicdefault\zf@family
+ \normalfont}
+\def\resetlatinfont{%
+\let\normalfont\latinfont%
+\latinfont}
+\def\setpersianfont{%
+\let\normalfont\persianfont%
+\persianfont}
\def\lr#1{\begingroup\beginL\latinfont#1\endL\endgroup}
\def\rl#1{\begingroup\beginR\persianfont#1\endR\endgroup}
-\def\latin{\bgroup\LatinAlphs\par\@RTLfalse\@RTL@footnotefalse\let\normalfont\latinfont\latinfont}
+\def\latin{\bgroup\LatinAlphs\par\@RTLfalse\@Latintrue\@RTL@footnotefalse\resetlatinfont}
\def\endlatin{\par\egroup}
-\def\persian{\bgroup\PersianAlphs\par\@RTLtrue\@RTL@footnotetrue\let\normalfont\persianfont\persianfont}
+\def\persian{\bgroup\PersianAlphs\par\@RTLtrue\@RTL@footnotetrue\setpersianfont}
\def\endpersian{\par\egroup}
-\def\Latin{\if@RTL\par\LatinAlphs\@RTLfalse\@RTL@footnotefalse\let\normalfont\latinfont\latinfont\fi}
-\def\Persian{\if@RTL\relax\else\par\PersianAlphs\@RTLtrue\@RTL@footnotetrue\let\normalfont\persianfont\persianfont\fi}
+\def\Latin{\if@RTL\par\LatinAlphs\@RTLfalse\@Latintrue\@RTL@footnotefalse\resetlatinfont\fi}
+\def\Persian{\if@RTL\relax\else\par\PersianAlphs\@RTLtrue\@Latinfalse\@RTL@footnotetrue\setpersianfont\fi}
\let\originaltoday=\today
\def\today{\lr{\originaltoday}}
\let\latintoday\today
\def\today{\rl{\persiantoday}}
+\def\@outputpage{%
+\begingroup % the \endgroup is put in by \aftergroup
+ \let \protect \noexpand
+ \@resetactivechars
+ \global\let\@@if@newlist\if@newlist
+ \global\@newlistfalse
+ \@parboxrestore
+ \shipout \vbox{%
+ \set@typeset@protect
+ \aftergroup \endgroup
+ \aftergroup \set@typeset@protect
+ % correct? or just restore by ending
+ % the group?
+ \if@specialpage
+ \global\@specialpagefalse\@nameuse{ps@\@specialstyle}%
+ \fi
+ \if@twoside
+ \ifodd\count\z@ \let\@thehead\@oddhead \let\@thefoot\@oddfoot
+ \let\@themargin\oddsidemargin
+ \else \let\@thehead\@evenhead
+ \let\@thefoot\@evenfoot \let\@themargin\evensidemargin
+ \fi
+ \ifx\@thehead\@empty \let\@thehead\hfil \fi
+ \ifx\@thefoot\@empty \let\@thefoot\hfil \fi
+ \else %% not @twoside
+ \ifx\@oddhead\@empty \let\@thehead\hfil \fi
+ \ifx\@oddfoot\@empty \let\@thefoot\hfil \fi
+ \fi
+ \reset@font
+ \normalsize
+ \if@RTLmain\setpersianfont\else\resetlatinfont\fi
+ \normalsfcodes
+ \let\label\@gobble
+ \let\index\@gobble
+ \let\glossary\@gobble
+ \baselineskip\z@skip \lineskip\z@skip \lineskiplimit\z@
+ \@begindvi
+ \vskip \topmargin
+ \moveright\@themargin \vbox {%
+ \setbox\@tempboxa \vbox to\headheight{%
+ \vfil
+ \color@hbox
+ \normalcolor
+ \hb@xt@\textwidth{\if@RTLmain\beginR\fi\@thehead\if@RTLmain\endR\fi}%
+ \color@endbox
+ }% %% 22 Feb 87
+ \dp\@tempboxa \z@
+ \box\@tempboxa
+ \vskip \headsep
+ \box\@outputbox
+ \baselineskip \footskip
+ \color@hbox
+ \normalcolor
+ \hb@xt@\textwidth{\if@RTLmain\beginR\fi\@thefoot\if@RTLmain\endR\fi}%
+ \color@endbox
+ }%
+ }%
+ \global\let\if@newlist\@@if@newlist
+ \global \@colht \textheight
+ \stepcounter{page}%
+ \let\firstmark\botmark
+}
\newcommand\twocolumnstableofcontents{%
+\@ifpackageloaded{multicol}{%
\begin{multicols}{2}[\section*{\contentsname}]%
\small
\@starttoc{toc}%
\end{multicols}}
-\def\XePersian{\lr{\leavevmode$\smash{\hbox{X\lower.5ex
- \hbox{\kern-.125em\reflect{E}}Persian}}$}}
-\def\TeX{\lr{\@@TeX}}
-\def\LaTeX{\lr{\@@LaTeX}}
-\def\LaTeXe{\lr{\@@LaTeXe}}
-\let\origin@XeTeX\XeTeX
-\def\XeTeX{\lr{\origin@XeTeX}}
-\let\origin@XeLaTeX\XeLaTeX
-\def\XeLaTeX{\lr{\origin@XeLaTeX}}
+{\PackageError{xepersian}{Oops! you should load multicol package before xepersian package for being able to use this command.}}}
+\def\XePersian{\leavevmode$\smash{\hbox{X\lower.5ex
+ \hbox{\kern-.125em\reflect{E}}Persian}}$}
\def\figurename{\if@RTL شکل\else Figure\fi}
\def\tablename{\if@RTL جدول\else Table\fi}
\def\contentsname{\if@RTL فهرست مطالب\else Contents\fi}
@@ -243,32 +310,38 @@ Persian typesetting in XeLaTeX]
\let\@Alph\@latinAlph%
}
\PersianAlphs
+\@ifdefinitionfileloaded{loadingorder-bidi}{\input{loadingorder-bidi-xepersian.def}}{}
\@ifpackageloaded{listings}{\input{listings-xepersian.def}}{}
\@ifpackageloaded{algorithmic}{\input{algorithmic-xepersian.def}}{}
\@ifpackageloaded{algorithm}{\input{algorithm-xepersian.def}}{}
\@ifpackageloaded{backref}{\input{backref-xepersian.def}}{}
+\@ifpackageloaded{flowfram}{\input{flowfram-xepersian.def}}{}
\@ifpackageloaded{bidi}{\input{footnote-bidi-xepersian.def}}{}
+\@ifpackageloaded{bidicode}{\input{bidicode-xepersian.def}}{}
+\@ifpackageloaded{breqn}{\input{breqn-xepersian.def}}{}
\@ifpackageloaded{enumerate}{\input{enumerate-xepersian.def}}{}
+\@ifpackageloaded{hyperref}{\input{hyperref-xepersian.def}}{}
\@ifpackageloaded{minitoc}{\input{minitoc-xepersian.def}}{}
+\@ifpackageloaded{multicol}{\input{multicol-xepersian.def}}{}
\@ifpackageloaded{tocloft}{\@ifclassloaded{memoir}{}{\input{tocloft-xepersian.def}}}{}
\@ifclassloaded{article}{\input{article-xepersian.def}}{}
\@ifclassloaded{amsart}{\input{amsart-xepersian.def}}{}
-\@ifclassloaded{bidimoderncv}{\input{bidimoderncv-xepersian.def}}{}
\@ifclassloaded{report}{\input{report-xepersian.def}}{}
\@ifclassloaded{rapport3}{\input{rapport3-xepersian.def}}{}
\@ifclassloaded{scrartcl}{\input{scrartcl-xepersian.def}}{}
\@ifclassloaded{scrbook}{\input{scrbook-xepersian.def}}{}
\@ifclassloaded{scrreprt}{\input{scrreprt-xepersian.def}}{}
-\@ifclassloaded{xepersian-thesis}{\input{xepersian-thesis-xepersian.def}}{}
\@ifclassloaded{amsbook}{\input{amsbook-xepersian.def}}{}
\@ifclassloaded{bookest}{\input{bookest-xepersian.def}}{}
\@ifclassloaded{extbook}{\input{extbook-xepersian.def}}{}
\@ifclassloaded{book}{\input{book-xepersian.def}}{}
\@ifclassloaded{refrep}{\input{refrep-xepersian.def}}{}
-\@ifclassloaded{bidibeamer}{\input{bidibeamer-xepersian.def}}{}
\@ifclassloaded{memoir}{\input{memoir-xepersian.def}}{}
+\DeclareOption{Kashida}{\input{kashida-xepersian.def}}
+\DeclareOption{localise}{\input{localise-xepersian.def}}
+\ProcessOptions
%%
-%% Copyright © 2008-2009 by Vafa Khalighi <vafa@users.berlios.de>
+%% Copyright © 2008-2010 by Vafa Khalighi <vafa@users.berlios.de>
%%
%% Distributable under the LaTeX Project Public License,
%% version 1.3c or higher (your choice). The latest version of