%% %% This is file `xepersian-persiancal.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% xepersian.dtx (with options: `table,xepersian-persiancal.sty') %% %% __________________________________________________ %% Vafa Khalighi %% %% Copyright (c) 2008--2023 Vafa Khalighi %% Copyright (c) 2018--2020 bidi-tex GitHub Organization %% %% 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{11192} %% \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-persiancal}[2012/07/25 v0.2 provides Persian calendar] \newif\ifXePersian@leap \newif\ifXePersian@kabiseh \newcount\XePersian@i \newcount\XePersian@y \newcount\XePersian@m \newcount\XePersian@d \newcount\XePersian@latini \newcount\XePersian@persiani \newcount\XePersian@latinii \newcount\XePersian@persianii \newcount\XePersian@latiniii \newcount\XePersian@persianiii \newcount\XePersian@latiniv \newcount\XePersian@persianiv \newcount\XePersian@latinv \newcount\XePersian@persianv \newcount\XePersian@latinvi \newcount\XePersian@persianvi \newcount\XePersian@latinvii \newcount\XePersian@persianvii \newcount\XePersian@latinviii \newcount\XePersian@persianviii \newcount\XePersian@latinix \newcount\XePersian@persianix \newcount\XePersian@latinx \newcount\XePersian@persianx \newcount\XePersian@latinxi \newcount\XePersian@persianxi \newcount\XePersian@latinxii \newcount\XePersian@persianxii \newcount\XePersian@persianxiii \newcount\XePersian@temp \newcount\XePersian@temptwo \newcount\XePersian@tempthree \newcount\XePersian@yModHundred \newcount\XePersian@thirtytwo \newcount\XePersian@dn \newcount\XePersian@sn \newcount\XePersian@mminusone \XePersian@y=\year \XePersian@m=\month \XePersian@d=\day \XePersian@temp=\XePersian@y \divide\XePersian@temp by 100\relax \multiply\XePersian@temp by 100\relax \XePersian@yModHundred=\XePersian@y \advance\XePersian@yModHundred by -\XePersian@temp\relax \ifodd\XePersian@yModHundred \XePersian@leapfalse \else \XePersian@temp=\XePersian@yModHundred \divide\XePersian@temp by 2\relax \ifodd\XePersian@temp\XePersian@leapfalse \else \ifnum\XePersian@yModHundred=0% \XePersian@temp=\XePersian@y \divide\XePersian@temp by 400\relax \multiply\XePersian@temp by 400\relax \ifnum\XePersian@y=\XePersian@temp\XePersian@leaptrue\else\XePersian@leapfalse\fi \else\XePersian@leaptrue \fi \fi \fi \XePersian@latini=31\relax \ifXePersian@leap \XePersian@latinii = 29\relax \else \XePersian@latinii = 28\relax \fi \XePersian@latiniii = 31\relax \XePersian@latiniv = 30\relax \XePersian@latinv = 31\relax \XePersian@latinvi = 30\relax \XePersian@latinvii = 31\relax \XePersian@latinviii = 31\relax \XePersian@latinix = 30\relax \XePersian@latinx = 31\relax \XePersian@latinxi = 30\relax \XePersian@latinxii = 31\relax \XePersian@thirtytwo=32\relax \XePersian@temp=\XePersian@y \advance\XePersian@temp by -17\relax \XePersian@temptwo=\XePersian@temp \divide\XePersian@temptwo by 33\relax \multiply\XePersian@temptwo by 33\relax \advance\XePersian@temp by -\XePersian@temptwo \ifnum\XePersian@temp=\XePersian@thirtytwo\XePersian@kabisehfalse \else \XePersian@temptwo=\XePersian@temp \divide\XePersian@temptwo by 4\relax \multiply\XePersian@temptwo by 4\relax \advance\XePersian@temp by -\XePersian@temptwo \ifnum\XePersian@temp=\z@\XePersian@kabisehtrue\else\XePersian@kabisehfalse\fi \fi \XePersian@tempthree=\XePersian@y % Number of Leap years \advance\XePersian@tempthree by -1 \XePersian@temp=\XePersian@tempthree % T := (MY-1) div 4 \divide\XePersian@temp by 4\relax \XePersian@temptwo=\XePersian@tempthree % T := T - ((MY-1) div 100) \divide\XePersian@temptwo by 100\relax \advance\XePersian@temp by -\XePersian@temptwo \XePersian@temptwo=\XePersian@tempthree % T := T + ((MY-1) div 400) \divide\XePersian@temptwo by 400\relax \advance\XePersian@temp by \XePersian@temptwo \advance\XePersian@tempthree by -611 % Number of Kabise years \XePersian@temptwo=\XePersian@tempthree % T := T - ((SY+10) div 33) * 8 \divide\XePersian@temptwo by 33\relax \multiply\XePersian@temptwo by 8\relax \advance\XePersian@temp by -\XePersian@temptwo \XePersian@temptwo=\XePersian@tempthree % \divide\XePersian@temptwo by 33\relax \multiply\XePersian@temptwo by 33\relax \advance\XePersian@tempthree by -\XePersian@temptwo \ifnum\XePersian@tempthree=32\advance\XePersian@temp by 1\fi % if (SY+10) mod 33=32 then Inc(T); \divide\XePersian@tempthree by 4\relax % T := T - ((SY+10) mod 33) div 4 \advance\XePersian@temp by -\XePersian@tempthree \advance\XePersian@temp by -137 % T := T - 137 Adjust the value \XePersian@persiani=31 \advance\XePersian@persiani by -\XePersian@temp % now 31 - T is the persiani \XePersian@persianii = 30\relax \ifXePersian@kabiseh \XePersian@persianiii = 30\relax \else \XePersian@persianiii = 29\relax \fi \XePersian@persianiv = 31\relax \XePersian@persianv = 31\relax \XePersian@persianvi = 31\relax \XePersian@persianvii = 31\relax \XePersian@persianviii= 31\relax \XePersian@persianix = 31\relax \XePersian@persianx = 30\relax \XePersian@persianxi = 30\relax \XePersian@persianxii = 30\relax \XePersian@persianxiii= 30\relax \XePersian@dn= 0\relax \XePersian@sn= 0\relax \XePersian@mminusone=\XePersian@m \advance\XePersian@mminusone by -1\relax \XePersian@i=0\relax \ifnum\XePersian@i < \XePersian@mminusone \loop \advance \XePersian@i by 1\relax \advance\XePersian@dn by \csname XePersian@latin\romannumeral\the\XePersian@i\endcsname \ifnum\XePersian@i<\XePersian@mminusone \repeat \fi \advance \XePersian@dn by \XePersian@d \XePersian@i=1\relax \XePersian@sn = \XePersian@persiani \ifnum \XePersian@sn<\XePersian@dn \loop \advance \XePersian@i by 1\relax \advance\XePersian@sn by \csname XePersian@persian\romannumeral\the\XePersian@i\endcsname \ifnum \XePersian@sn<\XePersian@dn \repeat \fi \ifnum \XePersian@i < 4 \XePersian@m = 9 \advance\XePersian@m by \XePersian@i \advance \XePersian@y by -622\relax \else \XePersian@m = \XePersian@i \advance \XePersian@m by -3\relax \advance \XePersian@y by -621\relax \fi \advance\XePersian@sn by -\csname XePersian@persian\romannumeral\the\XePersian@i% \endcsname \ifnum\XePersian@i = 1 \XePersian@d = \XePersian@dn \advance \XePersian@d by 30 \advance\XePersian@d by -\XePersian@persiani \else \XePersian@d = \XePersian@dn \advance \XePersian@d by -\XePersian@sn \fi \newcommand*{\persiantoday}{% \number\XePersian@d\space% \XePersian@persian@month{\XePersian@m}\space\number\XePersian@y% } \let\persianyear\XePersian@y \let\persianmonth\XePersian@m \let\persianday\XePersian@d \def\XePersian@persian@month#1{\ifcase#1\or فروردین\or اردیبهشت\or خرداد\or تیر\or مرداد\or شهریور\or مهر\or آبان\or آذر\or دی\or بهمن\or اسفند\fi} \endinput %% %% End of file `xepersian-persiancal.sty'.