diff options
Diffstat (limited to 'Master/texmf-dist/source/xelatex/xepersian/xepersian.dtx')
-rw-r--r-- | Master/texmf-dist/source/xelatex/xepersian/xepersian.dtx | 276 |
1 files changed, 160 insertions, 116 deletions
diff --git a/Master/texmf-dist/source/xelatex/xepersian/xepersian.dtx b/Master/texmf-dist/source/xelatex/xepersian/xepersian.dtx index 420eb9c01c7..53828f84372 100644 --- a/Master/texmf-dist/source/xelatex/xepersian/xepersian.dtx +++ b/Master/texmf-dist/source/xelatex/xepersian/xepersian.dtx @@ -5,7 +5,7 @@ %<*readme> ____________________ The XePersian package -v14.6 +v14.9 XePersian is a package written for XeLaTeX that allows users to typeset Persian easily. @@ -18,7 +18,7 @@ This version fixes bugs and adds new features; for more details please see the Change History section at the end of the documentation. -Current version release date: 2014/09/10 +Current version release date: 2014/09/21 ______________ Vafa Khalighi tex.ctan@gmail.com @@ -43,7 +43,7 @@ by Vafa Khalighi. \preamble __________________________________________________ - Copyright © 2008–2013 Vafa Khalighi <tex.ctan@gmail.com> + Copyright © 2008–2014 Vafa Khalighi <tex.ctan@gmail.com> It may be distributed and/or modified under the LaTeX Project Public License, version 1.3c or higher (your choice). The latest version of @@ -205,7 +205,7 @@ by Vafa Khalighi. % Persian for \LaTeX, using {\XeTeX} engine} % \author{Vafa Khalighi\\ % \url{tex.ctan@gmail.com}} -% \date{\today\qquad Version 14.6} +% \date{\today\qquad Version 14.9} %\maketitle % \tableofcontents %\section{Introduction} @@ -230,7 +230,7 @@ by Vafa Khalighi. %* %* Copyright © 2008–2014 Vafa Khalighi %* -%* v14.6, 2014/09/10 +%* v14.9, 2014/09/21 %* %* License: LaTeX Project Public License, version %* 1.3c or higher (your choice) @@ -2256,7 +2256,7 @@ by Vafa Khalighi. %\iffalse %<*table> %\fi -%% \CheckSum{9842} +%% \CheckSum{9899} %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z @@ -3777,7 +3777,7 @@ by Vafa Khalighi. %\fi % \subsection{\textsf{fontspec-xetex-xepersian.def}} % \begin{macrocode} -\ProvidesFile{fontspec-xetex-xepersian.def}[2014/10/07 v0.1 fixes for fontspec-xetex package] +\ProvidesFile{fontspec-xetex-xepersian.def}[2014/07/10 v0.1 fixes for fontspec-xetex package] \ExplSyntaxOn \DeclareDocumentCommand \aliasfontfeature {mm} { @@ -5563,11 +5563,12 @@ U+003E U+003E <> U+00BB ; >> -> RIGHT POINTING GUILLEMET % \subsection{\textsf{xepersian.sty}} % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\def\xepersianversion{v14.6} -\def\xepersiandate{2014/09/10} +\def\xepersianversion{v14.9} +\def\xepersiandate{2014/09/21} \ProvidesPackage{xepersian}[\xepersiandate\space \xepersianversion\space Persian typesetting in XeLaTeX] \RequirePackage{fontspec} +\RequirePackage{xkeyval} \RequirePackage{xepersian-persiancal} \RequirePackage{xepersian-mathsdigitspec} \RequirePackage[RTLdocument]{bidi} @@ -5579,7 +5580,7 @@ Persian typesetting in XeLaTeX] * typesetting, using fonts provided in the^^J% * distribution.^^J% * ^^J% -* Copyright © 2008–2013 Vafa Khalighi^^J% +* Copyright © 2008–2014 Vafa Khalighi^^J% * ^^J% * \xepersianversion, \xepersiandate^^J% * ^^J% @@ -5623,46 +5624,58 @@ Persian typesetting in XeLaTeX] \newfontscript{Parsi}{arab} \newfontlanguage{Parsi}{FAR} \ExplSyntaxOn -\DeclareDocumentCommand \settextfont { O{} m } { - \fontspec_select:nn{Script=Parsi,Language=Parsi,Mapping=parsidigits,#1}{#2} - \use:x { - \exp_not:N \DeclareRobustCommand \exp_not:N \persianfont { +\DeclareDocumentCommand \settextfont { O{} m O{} } + { + \fontspec_set_family:cnn { g__fontspec_ \cs_to_str:N \persianfont _family } {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1,#3} {#2} + \use:x + { + \exp_not:N \DeclareRobustCommand \exp_not:N \persianfont + { \exp_not:N \fontencoding {\g_fontspec_encoding_tl} - \exp_not:N \fontfamily {\l_fontspec_family_tl} \exp_not:N \selectfont - } - } + \exp_not:N \fontfamily { \use:c {g__fontspec_ \cs_to_str:N \persianfont _family} } \exp_not:N \selectfont + } + } \cs_set_eq:NN \rmdefault \l_fontspec_family_tl \normalfont -} -\DeclareDocumentCommand \setlatintextfont { O{} m } { - \fontspec_select:nn{Mapping=tex-text,#1}{#2} - \use:x { - \exp_not:N \DeclareRobustCommand \exp_not:N \latinfont { + } +\DeclareDocumentCommand \setlatintextfont { O{} m O{} } + { + \fontspec_set_family:cnn { g__fontspec_ \cs_to_str:N \latinfont _family } {Mapping=tex-text,#1,#3} {#2} + \use:x + { + \exp_not:N \DeclareRobustCommand \exp_not:N \latinfont + { \exp_not:N \fontencoding {\g_fontspec_encoding_tl} - \exp_not:N \fontfamily {\l_fontspec_family_tl} \exp_not:N \selectfont - } - } -} + \exp_not:N \fontfamily { \use:c {g__fontspec_ \cs_to_str:N \latinfont _family} } \exp_not:N \selectfont + } + } + } \cs_set_eq:NN \setlatinsansfont \setsansfont \cs_set_eq:NN \setlatinmonofont \setmonofont -\DeclareDocumentCommand \defpersianfont { m O{} m } { - \fontspec_select:nn{Script=Parsi,Language=Parsi,Mapping=parsidigits,#2}{#3} - \use:x { - \exp_not:N \DeclareRobustCommand \exp_not:N #1 { +\DeclareDocumentCommand \defpersianfont { m O{} m O{} } + { + \fontspec_set_family:cnn { g__fontspec_ \cs_to_str:N #1 _family } {Script=Parsi,Language=Parsi,Mapping=parsidigits,#2,#4} {#3} + \use:x + { + \exp_not:N \DeclareRobustCommand \exp_not:N #1 + { \exp_not:N \fontencoding {\g_fontspec_encoding_tl} - \exp_not:N \fontfamily {\l_fontspec_family_tl} \exp_not:N \selectfont - } - } -} -\DeclareDocumentCommand \deflatinfont { m O{} m } { - \fontspec_select:nn{Mapping=tex-text,#2}{#3} - \use:x { - \exp_not:N \DeclareRobustCommand \exp_not:N #1 { + \exp_not:N \fontfamily { \use:c {g__fontspec_ \cs_to_str:N #1 _family} } \exp_not:N \selectfont + } + } + } +\DeclareDocumentCommand \deflatinfont { m O{} m O{} } + { + \fontspec_set_family:cnn { g__fontspec_ \cs_to_str:N #1 _family } {Mapping=tex-text,#2,#4} {#3} + \use:x + { + \exp_not:N \DeclareRobustCommand \exp_not:N #1 + { \exp_not:N \fontencoding {\g_fontspec_encoding_tl} - \exp_not:N \fontfamily {\l_fontspec_family_tl} \exp_not:N \selectfont - } - } -} + \exp_not:N \fontfamily { \use:c {g__fontspec_ \cs_to_str:N #1 _family} } \exp_not:N \selectfont + } + } + } \newcommand\persiansfdefault{} \newcommand\persianttdefault{} \newcommand\iranicdefault{} @@ -5693,30 +5706,42 @@ Persian typesetting in XeLaTeX] \DeclareTextFontCommand{\textnavar}{\navarfamily} \DeclareTextFontCommand{\textpook}{\pookfamily} \DeclareTextFontCommand{\textsayeh}{\sayehfamily} -\DeclareDocumentCommand \setpersiansansfont { O{} m } { - \fontspec_set_family:Nnn \persiansfdefault {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1}{#2} +\DeclareDocumentCommand \setpersiansansfont { O{} m O{} } + { + \fontspec_set_family:Nnn \persiansfdefault {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1,#3}{#2} \normalfont -} -\DeclareDocumentCommand \setpersianmonofont { O{} m } { - \fontspec_set_family:Nnn \persianttdefault {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1}{#2} + \ignorespaces + } +\DeclareDocumentCommand \setpersianmonofont { O{} m O{} } + { + \fontspec_set_family:Nnn \persianttdefault {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1,#3}{#2} \normalfont -} -\DeclareDocumentCommand \setnavarfont { O{} m } { - \fontspec_set_family:Nnn \navardefault {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1}{#2} + \ignorespaces + } +\DeclareDocumentCommand \setnavarfont { O{} m O{} } + { + \fontspec_set_family:Nnn \navardefault {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1,#3}{#2} \normalfont -} -\DeclareDocumentCommand \setpookfont { O{} m } { - \fontspec_set_family:Nnn \pookdefault {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1}{#2} + \ignorespaces + } +\DeclareDocumentCommand \setpookfont { O{} m O{} } + { + \fontspec_set_family:Nnn \pookdefault {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1,#3}{#2} \normalfont -} -\DeclareDocumentCommand \setsayehfont { O{} m } { - \fontspec_set_family:Nnn \sayehdefault {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1}{#2} + \ignorespaces + } +\DeclareDocumentCommand \setsayehfont { O{} m O{} } + { + \fontspec_set_family:Nnn \sayehdefault {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1,#3}{#2} \normalfont -} -\DeclareDocumentCommand \setiranicfont { O{} m } { - \fontspec_set_family:Nnn \iranicdefault {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1}{#2} + \ignorespaces + } +\DeclareDocumentCommand \setiranicfont { O{} m O{} } + { + \fontspec_set_family:Nnn \iranicdefault {Script=Parsi,Language=Parsi,Mapping=parsidigits,#1,#3}{#2} \normalfont -} + \ignorespaces + } \ExplSyntaxOff \def\resetlatinfont{% \let\normalfont\latinfont% @@ -6158,59 +6183,76 @@ or load the package with `preloadedlatintextfont' option.}% \@ifclassloaded{refrep}{\input{refrep-xepersian.def}}{} \@ifclassloaded{memoir}{\input{memoir-xepersian.def}}{} \@ifclassloaded{imsproc}{\input{imsproc-xepersian.def}}{} -\DeclareOption{Kashida}{\input{kashida-xepersian.def}} -\DeclareOption{localise}{\input{localise-xepersian.def}} -\DeclareOption{extrafootnotefeatures}{\@extrafootnotefeaturestrue} -\DeclareOption{quickindex}{% -\PackageWarning{xepersian}{Obsolete option}% -\ifwritexviii% -\@ifclassloaded{memoir}{\PackageError{xepersian}{This feature does not yet work with the memoir class}{}}{% -\renewcommand\printindex{\newpage% -\immediate\closeout\@indexfile -\immediate\write18{xindy -L persian-variant2 -C utf8 -M texindy -M page-ranges \jobname.idx} -\@input@{\jobname.ind}}}% -\else -\PackageError{xepersian}{“shell escape” (or “write18”) is not enabled. You need to run “xelatex --shell-escape” on your TeX document for this feature to work}{} -\fi} -\DeclareOption{quickindex-variant1}{% -\ifwritexviii% -\@ifclassloaded{memoir}{\PackageError{xepersian}{This feature does not yet work with the memoir class}{}}{% -\renewcommand\printindex{\newpage% -\immediate\closeout\@indexfile -\immediate\write18{xindy -L persian-variant1 -C utf8 -M texindy -M page-ranges \jobname.idx} -\@input@{\jobname.ind}}}% -\else -\PackageError{xepersian}{“shell escape” (or “write18”) is not enabled. You need to run “xelatex --shell-escape” on your TeX document for this feature to work}{} -\fi} -\DeclareOption{quickindex-variant2}{% -\ifwritexviii% -\@ifclassloaded{memoir}{\PackageError{xepersian}{This feature does not yet work with the memoir class}{}}{% -\renewcommand\printindex{\newpage% -\immediate\closeout\@indexfile -\immediate\write18{xindy -L persian-variant2 -C utf8 -M texindy -M page-ranges \jobname.idx} -\@input@{\jobname.ind}}}% -\else -\PackageError{xepersian}{“shell escape” (or “write18”) is not enabled. You need to run “xelatex --shell-escape” on your TeX document for this feature to work}{} -\fi} -\DeclareOption{preloadedtextfont}{% -\settextfont[ExternalLocation,BoldFont={parisa-bold},BoldItalicFont={parisa-bolditalic},ItalicFont={parisa-italic},SlantedFont={parisa-oblique},BoldSlantedFont={parisa-boldoblique}]{parisa-regular}% +\define@choicekey{xepersian.sty}{Kashida}[\xepersian@tempa\xepersian@tempb]{on,off}[on]{% + \ifcase\xepersian@tempb\relax + \input{kashida-xepersian.def} + \fi} +\define@choicekey{xepersian.sty}{localise}[\xepersian@tempa\xepersian@tempb]{on,off}[on]{% + \ifcase\xepersian@tempb\relax + \input{localise-xepersian.def} + \fi} +\define@choicekey{xepersian.sty}{extrafootnotefeatures}[\xepersian@tempa\xepersian@tempb]{on,off}[on]{% + \ifcase\xepersian@tempb\relax + \@extrafootnotefeaturestrue + \or + \@extrafootnotefeaturesfalse + \fi} +\define@choicekey{xepersian.sty}{quickindex}[\xepersian@tempa\xepersian@tempb]{on,off}[on]{% + \ifcase\xepersian@tempb\relax + \PackageWarning{xepersian}{Obsolete option}% + \ifwritexviii% + \@ifclassloaded{memoir}{\PackageError{xepersian}{This feature does not yet work with the memoir class}{}}{% + \renewcommand\printindex{\newpage% + \immediate\closeout\@indexfile + \immediate\write18{xindy -L persian-variant2 -C utf8 -M texindy -M page-ranges \jobname.idx} + \@input@{\jobname.ind}}}% + \else + \PackageError{xepersian}{“shell escape” (or “write18”) is not enabled. You need to run “xelatex --shell-escape” on your TeX document for this feature to work}{} + \fi + \fi} +\define@choicekey{xepersian.sty}{quickindex-variant1}[\xepersian@tempa\xepersian@tempb]{on,off}[on]{% + \ifcase\xepersian@tempb\relax + \ifwritexviii% + \@ifclassloaded{memoir}{\PackageError{xepersian}{This feature does not yet work with the memoir class}{}}{% + \renewcommand\printindex{\newpage% + \immediate\closeout\@indexfile + \immediate\write18{xindy -L persian-variant1 -C utf8 -M texindy -M page-ranges \jobname.idx} + \@input@{\jobname.ind}}}% + \else + \PackageError{xepersian}{“shell escape” (or “write18”) is not enabled. You need to run “xelatex --shell-escape” on your TeX document for this feature to work}{} + \fi + \fi} +\define@choicekey{xepersian.sty}{quickindex-variant2}[\xepersian@tempa\xepersian@tempb]{on,off}[on]{% + \ifcase\xepersian@tempb\relax + \ifwritexviii% + \@ifclassloaded{memoir}{\PackageError{xepersian}{This feature does not yet work with the memoir class}{}}{% + \renewcommand\printindex{\newpage% + \immediate\closeout\@indexfile + \immediate\write18{xindy -L persian-variant2 -C utf8 -M texindy -M page-ranges \jobname.idx} + \@input@{\jobname.ind}}}% + \else + \PackageError{xepersian}{“shell escape” (or “write18”) is not enabled. You need to run “xelatex --shell-escape” on your TeX document for this feature to work}{} + \fi + \fi} +\DeclareOptionX{preloadedtextfont}{% +\settextfont[ExternalLocation,BoldFont={parisa-bold},BoldItalicFont={parisa-bolditalic},ItalicFont={parisa-italic},SlantedFont={parisa-oblique},BoldSlantedFont={parisa-boldoblique},#1]{parisa-regular}% } -\DeclareOption{preloadeddigitfont}{% -\setdigitfont[ExternalLocation,BoldFont={parisa-bold},BoldItalicFont={parisa-bolditalic},ItalicFont={parisa-italic},SlantedFont={parisa-oblique},BoldSlantedFont={parisa-boldoblique}]{parisa-regular}% +\DeclareOptionX{preloadeddigitfont}{% +\setdigitfont[ExternalLocation,BoldFont={parisa-bold},BoldItalicFont={parisa-bolditalic},ItalicFont={parisa-italic},SlantedFont={parisa-oblique},BoldSlantedFont={parisa-boldoblique},#1]{parisa-regular}% } -\DeclareOption{preloadedpookfont}{% -\setpookfont[ExternalLocation,ItalicFont={parisa-italicoutline},SlantedFont={parisa-obliqueoutline}]{parisa-outline}% +\DeclareOptionX{preloadedpookfont}{% +\setpookfont[ExternalLocation,ItalicFont={parisa-italicoutline},SlantedFont={parisa-obliqueoutline},#1]{parisa-outline}% } -\DeclareOption{preloadedsayehfont}{% -\setsayehfont[ExternalLocation,ItalicFont={parisa-italicshadow},SlantedFont={parisa-obliqueshadow}]{parisa-shadow}% +\DeclareOptionX{preloadedsayehfont}{% +\setsayehfont[ExternalLocation,ItalicFont={parisa-italicshadow},SlantedFont={parisa-obliqueshadow},#1]{parisa-shadow}% } -\DeclareOption{preloadediranicfont}{% -\setiranicfont[ExternalLocation,BoldFont={parisa-boldoblique}]{parisa-oblique}% +\DeclareOptionX{preloadediranicfont}{% +\setiranicfont[ExternalLocation,BoldFont={parisa-boldoblique},#1]{parisa-oblique}% } -\DeclareOption{preloadedlatintextfont}{% -\setlatintextfont[ExternalLocation,BoldFont={lmroman10-bold},BoldItalicFont={lmroman10-bolditalic},ItalicFont={lmroman10-italic},SmallCapsFont={lmromancaps10-regular},SlantedFont={lmromanslant10-regular},BoldSlantedFont={lmromanslant10-bold}]{lmroman10-regular}% +\DeclareOptionX{preloadedlatintextfont}{% +\setlatintextfont[ExternalLocation,BoldFont={lmroman10-bold},BoldItalicFont={lmroman10-bolditalic},ItalicFont={lmroman10-italic},SmallCapsFont={lmromancaps10-regular},SlantedFont={lmromanslant10-regular},BoldSlantedFont={lmromanslant10-bold},#1]{lmroman10-regular}% } -\ProcessOptions +\ProcessOptionsX \if@extrafootnotefeatures \input{extrafootnotefeatures-xetex-bidi.def} @@ -7101,7 +7143,7 @@ indexblock environment may only appear inside frontpage environment. % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{xepersian-mathsdigitspec} - [2014/07/13 v1.0.7 Unicode Persian maths digits in XeLaTeX] + [2014/10/21 v1.0.8 Unicode Persian maths digits in XeLaTeX] \def\new@mathgroup{\alloc@8\mathgroup\chardef\@cclvi} \let\newfam\new@mathgroup \def\select@group#1#2#3#4{% @@ -7240,9 +7282,9 @@ indexblock environment may only appear inside frontpage environment. #1 } } -\newcommand\setdigitfont[2][]{% +\DeclareDocumentCommand \setdigitfont { O{} m O{} }{% \let\glb@currsize\relax - \fontspec_set_family:Nnn \xepersian@digits@family {Mapping=parsidigits,#1}{#2} + \fontspec_set_family:Nnn \xepersian@digits@family {Mapping=parsidigits,#1,#3}{#2} \xepersian@PackageInfo{Defining the default Persian maths digits font as '#2'} \DeclareSymbolFont{OPERATORS} {EU1}{\xepersian@digits@family} {m}{n} \DeclareSymbolFont{new@mathbf@font@digits}{EU1}{\xepersian@digits@family}{bx}{n} @@ -7268,16 +7310,18 @@ indexblock environment may only appear inside frontpage environment. \cs_set_eq:NN \mathit \new@mathit \cs_set_eq:NN \mathrm \new@mathrm} } -\DeclareDocumentCommand \setmathsfdigitfont { O{} m } { - \fontspec_set_family:Nnn \g_fontspec_mathsf_tl {Mapping=parsidigits,#1}{#2} +\DeclareDocumentCommand \setmathsfdigitfont { O{} m O{} } + { + \fontspec_set_family:Nnn \g_fontspec_mathsf_tl {Mapping=parsidigits,#1,#3}{#2} \DeclareSymbolFont{new@mathsf@font@digits}{EU1}{\g_fontspec_mathsf_tl}{m}{n} \def\persianmathsfdigits{\cs_set_eq:NN \mathsf \new@mathsf} -} -\DeclareDocumentCommand \setmathttdigitfont { O{} m } { - \fontspec_set_family:Nnn \g_fontspec_mathtt_tl {Mapping=parsidigits,#1}{#2} + } +\DeclareDocumentCommand \setmathttdigitfont { O{} m O{} } + { + \fontspec_set_family:Nnn \g_fontspec_mathtt_tl {Mapping=parsidigits,#1,#3}{#2} \DeclareSymbolFont{new@mathtt@font@digits}{EU1}{\g_fontspec_mathtt_tl}{m}{n} \def\persianmathttdigits{\cs_set_eq:NN \mathtt \new@mathtt} -} + } \ExplSyntaxOff \ifx\newcommand\undefined\else \newcommand{\ZifferAn}{} |