diff options
author | Karl Berry <karl@freefriends.org> | 2016-10-07 22:28:23 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-10-07 22:28:23 +0000 |
commit | afcd66d4175ca6bdf3f4d9463557583ceeac632e (patch) | |
tree | f9d5e7695409860ae28d375e0866020cd6e16357 /Master/texmf-dist/tex/xelatex/xepersian/xepersian-mathsdigitspec.sty | |
parent | 31231686b0b60fdcd0a2ca264ffbbe8a11c4cdb1 (diff) |
xepersian is back (6oct16)
git-svn-id: svn://tug.org/texlive/trunk@42230 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/xelatex/xepersian/xepersian-mathsdigitspec.sty')
-rw-r--r-- | Master/texmf-dist/tex/xelatex/xepersian/xepersian-mathsdigitspec.sty | 260 |
1 files changed, 260 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..a6824a96ff3 --- /dev/null +++ b/Master/texmf-dist/tex/xelatex/xepersian/xepersian-mathsdigitspec.sty @@ -0,0 +1,260 @@ +%% +%% This is file `xepersian-mathsdigitspec.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% xepersian.dtx (with options: `table,xepersian-mathsdigitspec.sty') +%% +%% __________________________________________________ +%% Copyright (c) 2008--2016 Vafa Khalighi <persian-tex@tug.org> +%% +%% It may be distributed and/or modified under the LaTeX Project Public License, +%% version 1.3c or higher (your choice). The latest version of +%% this license is at: http://www.latex-project.org/lppl.txt +%% +%% This work is “author-maintained” (as per LPPL maintenance status) +%% by Vafa Khalighi. +%% +%% +%% \CheckSum{10112} +%% \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 +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{xepersian-mathsdigitspec} + [2016/05/03 v1.1.2 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{% + \ifx\math@bgroup\bgroup\else\relax\expandafter\@firstofone\fi + {% + \ifmmode + \ifnum\csname c@mv@\math@version\endcsname<\@cclvi + \begingroup + \escapechar\m@ne + \getanddefine@fonts{\csname c@mv@\math@version\endcsname}#3% + \globaldefs\@ne \math@fonts + \endgroup + \init@restore@version + \xdef#1{\noexpand\use@mathgroup\noexpand#2% + {\number\csname c@mv@\math@version\endcsname}}% + \global\advance\csname c@mv@\math@version\endcsname\@ne + \else + \let#1\relax + \@latex@error{Too many math alphabets used in + version \math@version}% + \@eha + \fi + \else \expandafter\non@alpherr\fi + #1{#4}% + }% +} +\def\document@select@group#1#2#3#4{% + \ifx\math@bgroup\bgroup\else\relax\expandafter\@firstofone\fi + {% + \ifmmode + \ifnum\csname c@mv@\math@version\endcsname<\@cclvi + \begingroup + \escapechar\m@ne + \getanddefine@fonts{\csname c@mv@\math@version\endcsname}#3% + \globaldefs\@ne \math@fonts + \endgroup + \expandafter\extract@alph@from@version + \csname mv@\math@version\expandafter\endcsname + \expandafter{\number\csname + c@mv@\math@version\endcsname}% + #1% + \global\advance\csname c@mv@\math@version\endcsname\@ne + \else + \let#1\relax + \@latex@error{Too many math alphabets used + in version \math@version}% + \@eha + \fi + \else \expandafter\non@alpherr\fi + #1{#4}% + }% +} +\ExplSyntaxOn +\bool_set_false:N \g__fontspec_math_bool +\tl_map_inline:nn + { + \new@mathgroup\cdp@list\cdp@elt\DeclareMathSizes + \@DeclareMathSizes\newmathalphabet\newmathalphabet@@\newmathalphabet@@@ + \DeclareMathVersion\define@mathalphabet\define@mathgroup\addtoversion + \version@list\version@elt\alpha@list\alpha@elt + \restore@mathversion\init@restore@version\dorestore@version\process@table + \new@mathversion\DeclareSymbolFont\group@list\group@elt + \new@symbolfont\SetSymbolFont\SetSymbolFont@\get@cdp + \DeclareMathAlphabet\new@mathalphabet\SetMathAlphabet\SetMathAlphabet@ + \DeclareMathAccent\set@mathaccent\DeclareMathSymbol\set@mathchar + \set@mathsymbol\DeclareMathDelimiter\@xxDeclareMathDelimiter + \@DeclareMathDelimiter\@xDeclareMathDelimiter\set@mathdelimiter + \set@@mathdelimiter\DeclareMathRadical\mathchar@type + \DeclareSymbolFontAlphabet\DeclareSymbolFontAlphabet@ + } + { + \tl_remove_once:Nn \@preamblecmds {\do#1} + } +\ExplSyntaxOff +\newcommand\xepersian@PackageInfo[1]{\PackageInfo{xepersian-mathsdigitspec}{#1}} +\newcommand\SetMathCode[4]{% + \Umathcode#1="\mathchar@type#2 \csname sym#3\endcsname #4\relax} +\newcommand\SetMathCharDef[4]{% + \Umathchardef#1="\mathchar@type#2 \csname sym#3\endcsname #4\relax} +\ExplSyntaxOn +\cs_new_eq:NN \orig_mathbf:n \mathbf +\cs_new_eq:NN \orig_mathit:n \mathit +\cs_new_eq:NN \orig_mathrm:n \mathrm +\cs_new_eq:NN \orig_mathsf:n \mathsf +\cs_new_eq:NN \orig_mathtt:n \mathtt +\NewDocumentCommand \new@mathbf { m } { + \orig_mathbf:n { + \int_step_inline:nnnn { `0 } { \c_one } { `9 } { + \mathcode ##1 = \numexpr "100 * \symnew@mathbf@font@digits + ##1 \relax + } + #1 + } +} +\NewDocumentCommand \new@mathit { m } { + \orig_mathit:n { + \int_step_inline:nnnn { `0 } { \c_one } { `9 } { + \mathcode ##1 = \numexpr "100 * \symnew@mathit@font@digits + ##1 \relax + } + #1 + } +} +\NewDocumentCommand \new@mathrm { m } { + \orig_mathrm:n { + \int_step_inline:nnnn { `0 } { \c_one } { `9 } { + \mathcode ##1 = \numexpr "100 * \symnew@mathrm@font@digits + ##1 \relax + } + #1 + } +} +\NewDocumentCommand \new@mathsf{ m } { + \orig_mathsf:n { + \int_step_inline:nnnn { `0 } { \c_one } { `9 } { + \mathcode ##1 = \numexpr "100 * \symnew@mathsf@font@digits + ##1 \relax + } + #1 + } +} +\NewDocumentCommand \new@mathtt{ m } { + \orig_mathtt:n { + \int_step_inline:nnnn { `0 } { \c_one } { `9 } { + \mathcode ##1 = \numexpr "100 * \symnew@mathtt@font@digits + ##1 \relax + } + #1 + } +} +\DeclareDocumentCommand \setdigitfont { o m }{% + \let\glb@currsize\relax + \__fontspec_pass_args:nnn \__xepersian_setdigitfont:nn {#1} {#2} } + +\cs_new:Nn \__xepersian_setdigitfont:nn + { + \fontspec_set_family:Nnn \xepersian@digits@family {Mapping=parsidigits,#1} {#2} + \xepersian@PackageInfo{Defining the default Persian maths digits font as '#2'} + \DeclareSymbolFont{OPERATORS} {\g_fontspec_encoding_tl}{\xepersian@digits@family} {m}{n} + \DeclareSymbolFont{new@mathbf@font@digits}{\g_fontspec_encoding_tl}{\xepersian@digits@family}{bx}{n} + \DeclareSymbolFont{new@mathit@font@digits}{\g_fontspec_encoding_tl}{\xepersian@digits@family}{m}{it} + \DeclareSymbolFont{new@mathrm@font@digits}{\g_fontspec_encoding_tl}{\xepersian@digits@family}{m}{n} + \def\persianmathsdigits{% + \SetMathCode{`0}{\mathalpha}{OPERATORS}{`0} + \SetMathCode{`1}{\mathalpha}{OPERATORS}{`1} + \SetMathCode{`2}{\mathalpha}{OPERATORS}{`2} + \SetMathCode{`3}{\mathalpha}{OPERATORS}{`3} + \SetMathCode{`4}{\mathalpha}{OPERATORS}{`4} + \SetMathCode{`5}{\mathalpha}{OPERATORS}{`5} + \SetMathCode{`6}{\mathalpha}{OPERATORS}{`6} + \SetMathCode{`7}{\mathalpha}{OPERATORS}{`7} + \SetMathCode{`8}{\mathalpha}{OPERATORS}{`8} + \SetMathCode{`9}{\mathalpha}{OPERATORS}{`9} + \SetMathCode{`\%}{\mathbin}{OPERATORS}{`٪} + \SetMathCharDef{\decimalseparator}{\mathord}{OPERATORS}{"066B} + \cs_set_eq:NN \mathbf \new@mathbf + \cs_set_eq:NN \mathit \new@mathit + \cs_set_eq:NN \mathrm \new@mathrm} + } +\DeclareDocumentCommand \setmathsfdigitfont { o m } + { \__fontspec_pass_args:nnn \__xepersian_setmathsfdigitfont:nn {#1} {#2} } + +\cs_new:Nn \__xepersian_setmathsfdigitfont:nn + { + \fontspec_set_family:Nnn \g__fontspec_mathsf_tl {Mapping=parsidigits,#1} {#2} + \DeclareSymbolFont{new@mathsf@font@digits}{\g_fontspec_encoding_tl}{\g__fontspec_mathsf_tl}{m}{n} + \def\persianmathsfdigits{\cs_set_eq:NN \mathsf \new@mathsf} + } +\DeclareDocumentCommand \setmathttdigitfont { o m } + { \__fontspec_pass_args:nnn \__xepersian_setmathttdigitfont:nn {#1} {#2} } + +\cs_new:Nn \__xepersian_setmathttdigitfont:nn + { + \fontspec_set_family:Nnn \g__fontspec_mathtt_tl {Mapping=parsidigits,#1} {#2} + \DeclareSymbolFont{new@mathtt@font@digits}{\g_fontspec_encoding_tl}{\g__fontspec_mathtt_tl}{m}{n} + \def\persianmathttdigits{\cs_set_eq:NN \mathtt \new@mathtt} + } +\ExplSyntaxOff +\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 + \ifx\n\overline\endgroup#1\else + \endgroup#2% + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi} +\mathcode`.="8000\relax +\def\ZifferLeer{\ifx\decimalseparator\undefined .\else \decimalseparator\fi} +\def\DefaultMathsDigits{\def\SetMathsDigits{}} +\def\PersianMathsDigits{\def\SetMathsDigits{% +\ifx\persianmathsdigits\undefined\else\persianmathsdigits\fi% +\ifx\persianmathsfdigits\undefined\else\persianmathsfdigits\fi% +\ifx\persianmathttdigits\undefined\else\persianmathttdigits\fi}} +\def\AutoMathsDigits{\def\SetMathsDigits{% +\ifx\persianmathsdigits\undefined\else\if@nonlatin\persianmathsdigits\fi\fi% +\ifx\persianmathsfdigits\undefined\else\if@nonlatin\persianmathsfdigits\fi\fi% +\ifx\persianmathttdigits\undefined\else\if@nonlatin\persianmathttdigits\fi\fi}} +\AutoMathsDigits +\everymath\expandafter{\the\everymath\SetMathsDigits} +\g@addto@macro\document{\everydisplay\expandafter{\the\everydisplay\SetMathsDigits}} +\endinput +%% +%% End of file `xepersian-mathsdigitspec.sty'. |