diff options
Diffstat (limited to 'Master/texmf-dist/tex/xelatex/xepersian/xepersian-mathsdigitspec.sty')
-rw-r--r-- | Master/texmf-dist/tex/xelatex/xepersian/xepersian-mathsdigitspec.sty | 383 |
1 files changed, 383 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/xelatex/xepersian/xepersian-mathsdigitspec.sty b/Master/texmf-dist/tex/xelatex/xepersian/xepersian-mathsdigitspec.sty new file mode 100644 index 00000000000..9317c8dccc5 --- /dev/null +++ b/Master/texmf-dist/tex/xelatex/xepersian/xepersian-mathsdigitspec.sty @@ -0,0 +1,383 @@ +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{xepersian-mathsdigitspec} + [2008/09/27 v0.1 Unicode Farsi maths digits 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[quiet]{fontspec} +\@ifpackageloaded{xepersian-mathsdigitspec}{\@zf@mathfalse}{} +\newcounter{um@fam} +\newif\if@um@fontspec@feature +\newif\if@um@ot@math@ +\newif\if@um@init +\providecommand\def@cn[2]{% + \expandafter\def\csname#1\endcsname{#2}} +\def\um@Loop#1\um@Pool{#1\um@Loop#1\um@Pool} +\def\um@Break#1\um@Pool{} +\long\def\um@FOR#1=[#2:#3]\do#4{% + #1=#2\relax + \um@Loop #4% + \advance#1\@ne + \ifnum#1>#3\relax + \expandafter\um@Break + \fi + \um@Pool} +\newcommand\um@PackageError[2]{\PackageError{xepersian-mathsdigitspec}{#1}{#2}} +\newcommand\um@PackageWarning[1]{\PackageWarning{xepersian-mathsdigitspec}{#1}} +\newcommand\um@PackageInfo[1]{\PackageInfo{xepersian-mathsdigitspec}{#1}} +\def\um@usv@num{`\0} +\def\um@usv@bbnum{"1D7D8} +\def\um@usv@sfnum{"1D7E2} +\def\um@usv@ttnum{"1D7F6} + +\def\um@usv@bfnum{"1D7CE} + +\def\um@usv@bfsfnum{"1D7EC} +\define@choicekey*{xepersian-mathsdigitspec.sty} + {math-style}[\@tempa\@tempb]{iso,tex,french,literal}{% + \ifcase\@tempb\relax + \or + \@um@literaltrue + \fi} +\define@choicekey*{xepersian-mathsdigitspec.sty}{bold-style}[\@tempa\@tempb]{iso,tex,french,literal}{% + \ifcase\@tempb\relax + \or + \@um@bfliteraltrue + \fi} +\ExecuteOptionsX{math-style=iso} +\ProcessOptionsX +\def\@preamblecmds{} + +\newcommand\not@onlypreamble[1]{{% + \def\do##1{\ifx#1##1\else\noexpand\do\noexpand##1\fi}% + \xdef\@preamblecmds{\@preamblecmds}}} +\def\gm@notprerr{ can be used only in preamble (\on@line)} +\AtBeginDocument{% + \def\do#1{\noexpand\do\noexpand#1}% + \edef\@preamblecmds{% + \def\noexpand\do##1{% + \def##1{\noexpand\PackageError{gmutils/LaTeX}% + {\noexpand\string##1 \noexpand\gm@notprerr}\noexpand\@eha}}% + \@preamblecmds}} +\def\nocite#1{% + \@bsphack{\setbox0=\hbox{\cite{#1}}}\@esphack} + +\def\um@fontdimen@percent#1#2{% + 0.\strip@pt\dimexpr\fontdimen#1#2 *65536\relax} +\def\um@scaled@apply#1#2#3{% + \ifx#1\scriptstyle + #2\um@fontdimen@percent{10}\um@font#3% + \else + \ifx#1\scriptscriptstyle + #2\um@fontdimen@percent{11}\um@font#3% + \else + #2#3% + \fi + \fi} +\def\new@mathgroup{\alloc@8\mathgroup\chardef\@cclvi} +\let\newfam\new@mathgroup +\def\um@mathsymbol#1#2#3#4{% + \expandafter\um@set@mathsymbol\csname sym#3\endcsname#1#2{#4}} +\def\um@set@mathsymbol#1#2#3#4{% + \ifx\mathop#3\relax + \begingroup + \catcode#4=\active + \global\mathcode#4="8000\relax + \um@scanactivedef#4\@nil{\csname\string#2@op\endcsname}% + \endgroup + \expandafter\global\expandafter\XeTeXmathchardef + \csname\string#2@sym\endcsname + ="\mathchar@type#3 #1 #4\relax + \expandafter\gdef\csname\string#2@op\endcsname{% + \csname\string#2@sym\endcsname + \expandafter\in@\expandafter#2\expandafter{\um@nolimits}% + \ifin@ + \expandafter\nolimits + \fi}% + \else + \expandafter\in@\expandafter#2\expandafter{\um@radicals,}% + \ifin@ + \expandafter\gdef\csname + \expandafter\@gobble\string#2sign\endcsname + {\XeTeXradical#1 #4\relax}% + \else + \ifx\mathopen#3\relax + \gdef#2{\XeTeXdelimiter "\mathchar@type#3 #1 #4}% + \global\XeTeXdelcode#4=#1 #4\relax + \global\XeTeXmathcode#4="\mathchar@type#3 #1 #4\relax + \else + \ifx\mathclose#3\relax + \gdef#2{\XeTeXdelimiter "\mathchar@type#3 #1 #4}% + \global\XeTeXdelcode#4=#1 #4\relax + \global\XeTeXmathcode#4="\mathchar@type#3 #1 #4\relax + \else + \ifx\mathaccent#3\relax + \xdef#2{\XeTeXmathaccent "\mathchar@type#3 #1 #4\relax}% + \else + \global\XeTeXmathcode#4="\mathchar@type#3 #1 #4\relax + \fi + \fi + \fi + \fi + \fi} +\newcommand\SetMathCode[4]{% + \XeTeXmathcode#1="\mathchar@type#2 \csname sym#3\endcsname #4\relax} +\newcommand\SetMathCharDef[4]{% + \XeTeXmathchardef#1="\mathchar@type#2 \csname sym#3\endcsname #4\relax} +\newcommand\setdigitfont[2][]{% + \let\glb@currsize\relax + \let\um@char@range\@empty + \let\um@char@num@range\@empty + \@um@initfalse + \@um@fontspec@featuretrue + \csname S@\f@size\endcsname + \def\um@mversion{normal}% + \DeclareMathVersion{\um@mversion}% + \def\um@ScriptFeatures{ScriptStyle}% + \def\um@ScriptScriptFeatures{ScriptScriptStyle}% + \def\um@ScriptFont{#2}% + \def\um@ScriptScriptFont{#2}% + \setkeys*[um]{options}{#1}% + \edef\@tempa{\noexpand\zf@fontspec{% + Script=Math,SizeFeatures={% + {Size=\tf@size-},% + {Size=\sf@size-\tf@size,% + Font=\um@ScriptFont,% + \um@ScriptFeatures},% + {Size=-\sf@size,% + Font=\um@ScriptScriptFont,% + \um@ScriptScriptFeatures}},% + \XKV@rm}{#2}}\@tempa + \font\um@font="#2"\relax + \ifdim \dimexpr\fontdimen9\um@font*65536\relax =65pt + \@um@ot@math@true + \fi + \ifx\um@char@range\@empty + \def\um@symfont{um@allsym}% + \um@PackageInfo{Defining the default maths font as '#2'}% + \let\UnicodeMathSymbol\um@mathsymbol@noparse + \DeclareSymbolFont{momayez}{EU1}{\zf@family}{m}{n}% + \SetMathCharDef{\momayez}{\mathpunct}{momayez}{"066B}% + \else + \stepcounter{um@fam}% + \edef\um@symfont{um@fam\theum@fam}% + \let\UnicodeMathSymbol\um@mathsymbol@parse + \fi + \DeclareSymbolFont{\um@symfont} + {\encodingdefault}{\zf@family}{\mddefault}{\updefault}% + \if@um@init + \input xepersian-mathsdigitspec.tex\relax + \else + \unless\ifx\um@char@range\@empty + \input xepersian-mathsdigitspec.tex\relax + \fi + \fi + \ifx\um@char@range\@empty + \um@def@numbers + \fi +} +\newcommand\um@mathsymbol@noparse[4]{% + \um@mathsymbol{#2}{#3}{\um@symfont}{#1}} +\newcommand\um@mathsymbol@parse[4]{% + \um@parse@term{#1}{#2}{#3}{% + \um@mathsymbol{#2}{#3}{\um@symfont}{#1}}} +\newcommand\um@mk@math[1]{% + \expandafter\def\csname math#1\endcsname##1{% + \begingroup + \csname um@math#1\endcsname + ##1 + \endgroup}} +\newcommand\um@mathmap@noparse[3]{% + \@for\@ii:=#2\do{% + \expandafter\expandafter + \expandafter\um@addto@mathmap + \expandafter\expandafter + \expandafter{% + \expandafter\um@symfont + \expandafter}% + \expandafter{\@ii}{#1}{#3}% + }}% +\newcommand\um@mathmap@parse[3]{% + \@for\@ii:=\um@char@num@range\do{% + \ifnum\@ii=#3\relax + \@for\@jj:=#2\do{% + \expandafter\expandafter + \expandafter\um@addto@mathmap + \expandafter\expandafter + \expandafter{% + \expandafter\um@symfont + \expandafter}% + \expandafter{\@jj}{#1}{#3}}% + \fi}}% +\newcommand\um@addto@mathmap[4]{% + \expandafter\g@addto@macro + \csname um@\expandafter\@gobble\string#3\endcsname{% + \SetMathCode{#2}{\mathalpha}{#1}{#4}}} +\def\um@nolimits{% + \@elt\int\@elt\iint\@elt\iiint\@elt\iiiint\@elt\oint\@elt\oiint\@elt\oiiint + \@elt\intclockwise\@elt\varointclockwise\@elt\ointctrclockwise\@elt\sumint + \@elt\intbar\@elt\intBar\@elt\fint\@elt\cirfnint\@elt\awint\@elt\rppolint + \@elt\scpolint\@elt\npolint\@elt\pointint\@elt\sqint\@elt\intlarhk\@elt\intx + \@elt\intcap\@elt\intcup\@elt\upint\@elt\lowint} +\newcommand\addnolimits[1]{% + \expandafter\def + \expandafter\um@nolimits + \expandafter{\um@nolimits\@elt#1}} +\def\removenolimits#1{% + \begingroup + \def\@elt##1{% + \ifx##1#1\else + \noexpand\@elt\noexpand##1 + \fi} + \xdef\um@nolimits{\um@nolimits}% + \endgroup} +\def\um@radicals{\sqrt} +\def\r@@t#1#2{% + \setbox\z@\hbox{$\m@th #1\sqrtsign{#2}$}% + \um@scaled@apply{#1}{\kern}{\fontdimen63\um@font}% + \raise \dimexpr( + \um@fontdimen@percent{65}{\um@font}\ht\z@- + \um@fontdimen@percent{65}{\um@font}\dp\z@ + )\relax + \copy \rootbox% + \um@scaled@apply{#1}{\kern}{\fontdimen64\um@font}% + \box \z@} +\let\left@primitive\left +\def\left{\mathopen{}\left@primitive} +\newcommand\um@zf@feature[2]{% + \define@key[zf]{options}{#1}[]{% + \if@um@fontspec@feature + #2 + \fi}} +\um@zf@feature{ScriptStyle}{% + \zf@update@ff{+ssty=0}} +\um@zf@feature{ScriptScriptStyle}{% + \zf@update@ff{+ssty=1}} +\define@cmdkey[um]{options}[um@]{ScriptFeatures}{} +\define@cmdkey[um]{options}[um@]{ScriptScriptFeatures}{} +\define@cmdkey[um]{options}[um@]{ScriptFont}{} +\define@cmdkey[um]{options}[um@]{ScriptScriptFont}{} +\define@choicekey+[um]{options}{Range}[\@tempa\@tempb]{ALL}{% + \ifcase\@tempb\relax + \@um@inittrue + \fi}{% else: + \xdef\um@char@range{\zap@space#1 \@empty}} +\newcommand\um@parse@term[4]{% + \@for\@ii:=\um@char@range\do{% + \unless\ifx\@ii\@empty + \@tempswafalse + \expandafter\um@firstchar\expandafter{\@ii}% + \ifx\@tempa\um@backslash + \expandafter\ifx\@ii#2\relax + \@tempswatrue + \else + \expandafter\ifx\@ii#3\relax + \@tempswatrue + \fi + \fi + \else + \expandafter\um@parse@range\@ii-\@marker-\@nil#1\@nil + \fi + \if@tempswa + \ifx\um@char@num@range\@empty + \g@addto@macro\um@char@num@range{#1}% + \else + \g@addto@macro\um@char@num@range{,#1}% + \fi + #4% + \fi + \fi}} +\def\um@firstof#1#2\@nil{#1} +\edef\um@backslash{\expandafter\um@firstof\string\string\@nil} +\def\um@firstchar#1{\edef\@tempa{\expandafter\um@firstof\string#1\@nil}} +\def\um@parse@range#1-#2-#3\@nil#4\@nil{% + \def\@tempa{#1}% + \def\@tempb{#2}% + \expandafter\ifx\expandafter\@marker\@tempb\relax + \ifnum#4=#1\relax + \@tempswatrue + \fi + \else + \ifx\@empty\@tempb + \ifnum#4>\numexpr#1-1\relax + \@tempswatrue + \fi + \else + \ifx\@empty\@tempa + \ifnum#4<\numexpr#2+1\relax + \@tempswatrue + \fi + \else + \ifnum#4>\numexpr#1-1\relax + \ifnum#4<\numexpr#2+1\relax + \@tempswatrue + \fi\fi\fi\fi\fi} +\newcommand\um@setmathcode[3][1]{% + \@for\um@inp:=#2\do{% + \um@FOR\@tempcnta=[1:#1]\do{% + \SetMathCode{\numexpr\um@inp+\@tempcnta-1\relax} + {\mathalpha}{\um@symfont}{\numexpr#3+\@tempcnta-1\relax}}}} +\newcommand\um@setmathalph[4][1]{% + \@for\um@inp:=#3\do{% + \um@FOR\@tempcnta=[1:#1]\do{% + \edef\@tempa{% + \noexpand\um@setsinglemathalph + {\noexpand#2} + {\number\numexpr \um@inp+\@tempcnta-1 \relax} + {\number\numexpr #4+\@tempcnta-1 \relax}}\@tempa}}} +\newcommand\um@def@numbers{% + \um@setmathcode[10]{\um@usv@num}{\um@usv@num}} +\begingroup + \catcode`\^=12\relax + \gdef\um@scancharlet#1="#2\@nil{% + \lowercase{\scantokens{\global\let#1=^^^^^#2}}} + \catcode`\^=12\relax + \gdef\um@scanactivedef"#1\@nil#2{% + \lowercase{\scantokens{\global\def^^^^^#1{#2}}}} +\endgroup +\let\unicodemathgobble\@gobble +\begingroup + \def\UnicodeMathSymbol#1#2#3#4{% + \um@scancharlet#2=#1\@nil} + \input xepersian-mathsdigitspec.tex\relax +\endgroup +\DeclareRobustCommand\sqrt{\@ifnextchar[\@sqrt\sqrtsign} +\ifx\newcommand\undefined\else + \newcommand{\ZifferAn}{} +\fi +\mathchardef\ziffer@DotOri="013A +{\ZifferAn + \catcode`\.=\active\gdef.{\begingroup\obeyspaces\futurelet\n\ziffer@dcheck}} +\def\ziffer@dcheck{\ziffer@check\ZifferLeer\ziffer@DotOri} +\def\ziffer@check#1#2{% + \ifx\n1\endgroup#1\else + \ifx\n2\endgroup#1\else + \ifx\n3\endgroup#1\else + \ifx\n4\endgroup#1\else + \ifx\n5\endgroup#1\else + \ifx\n6\endgroup#1\else + \ifx\n7\endgroup#1\else + \ifx\n8\endgroup#1\else + \ifx\n9\endgroup#1\else + \ifx\n0\endgroup#1\else + \endgroup#2% + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi} +\mathcode`.="8000\relax +\def\ZifferLeer{\ifx\momayez\undefied .\else \momayez\fi} +\endinput
\ No newline at end of file |