blob: 6de4d10ae1731cb42d2ea61098b1d3a477c9553f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
|
%%
%% This is file `xepersian-persiancal.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% xepersian.dtx (with options: `table,xepersian-persiancal.sty')
%%
%% __________________________________________________
%% Copyright © 2008–2013 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{10026}
%% \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'.
|