%% %% This is file `hebcal.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% hebrew.dtx (with options: `calendar') %% %% This is a generated file. %% %% Copyright 1997-1998 Boris Lavva and any individual authors %% listed elsewhere in this file. All rights reserved. %% %% For further copyright information, and conditions for modification %% and distribution, see any other copyright notices in this file. %% %% This file is contributed to the Babel system, release 3.6. %% ---------------------------------------------------------- %% This system is distributed in the hope that it will be useful, %% but WITHOUT ANY WARRANTY; without even the implied warranty of %% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. %% %% For error reports concerning UNCHANGED versions of this file no %% more than one year old, see bugs.txt. %% %% Please do not request updates from me directly. Primary %% distribution is through the CTAN archives. %% %% %% IMPORTANT COPYRIGHT NOTICE: %% %% You are NOT ALLOWED to distribute this file alone. %% %% You are allowed to distribute this file under the condition that it %% is distributed together with all the files listed in manifest.txt. %% %% If you receive only some of these files from someone, complain! %% %% %% Permission is granted to customize the declarations in this file to %% serve the needs of your installation, provided that you comply with %% the conditions in the file legal.txt. %% %% However, NO PERMISSION is granted to distribute a modified version %% of this file under its original name. %% %% %% MODIFICATION ADVICE: %% %% If you want to customize this file, it is best to make a copy of %% the source file(s) from which it was produced. Use a different %% name for your copy(ies) and modify the copy(ies); this will ensure %% that your modifications do not get overwritten when you install a %% new release of the standard system. %% %% You can then easily distribute your modifications by distributing %% the modified and renamed copy of the source file, together with a %% suitable .ins file, taking care to observe the conditions in %% legal.txt; this will ensure that other users can safely use %% your modifications. %% %% The names of the source files used are shown above. %% %% %% TeX & LaTeX macros for computing Hebrew date from Gregorian one %% Copyright (C) 1991 by Michail Rozman, misha@iop.tartu.ew.su %% \ProvidesPackage{hebcal} [1998/01/01 v2.0a Hebrew calendar (test version: still liable to change)] \newcount\Hebrewday \newcount\Hebrewmonth \newcount\Hebrewyear \def\Hebrewdate#1#2#3{% \HebrewFromGregorian{#1}{#2}{#3} {\Hebrewday}{\Hebrewmonth}{\Hebrewyear}% \ifundefined{if@rl}% \FormatForEnglish{\Hebrewday}{\Hebrewmonth}{\Hebrewyear}% \else% \FormatDate{\Hebrewday}{\Hebrewmonth}{\Hebrewyear}% \fi} \def\Hebrewtoday{\Hebrewdate{\day}{\month}{\year}} \let\hebrewtoday=\Hebrewtoday \def\Hebrewsetreg{% \HebrewFromGregorian{\day}{\month}{\year} {\Hebrewday}{\Hebrewmonth}{\Hebrewyear}} \def\FormatDate#1#2#3{% \if@rl% \FormatForHebrew{#1}{#2}{#3}% \else% \FormatForEnglish{#1}{#2}{#3} \fi} \def\HebrewYearChar{'} \def\ShortHYName#1{{% \count2 = #1% \Remainder{\count2}{1000}{#1}% E.g., for 5752: #1 = 752 \def\HY{}% the string of hundreds, tens and ones \ifnum #1 > 799 \strcat{\HY}{\tav\tav}\advance#1 by -800 \fi% \ifnum #1 > 399 \strcat{\HY}{\tav}\advance#1 by -400 \fi% \ifnum #1 > 299 \strcat{\HY}{\shin}\advance#1 by -300 \fi% \ifnum #1 > 199 \strcat{\HY}{\resh}\advance#1 by -200 \fi% \ifnum #1 > 99 \strcat{\HY}{\qof}\advance#1 by -100 \fi% \ifnum #1 > 0 \ifnum #1 = 16 % \strcat{\HY}{\tet\zayin}% \else% \ifnum #1 = 15 % \strcat{\HY}{\tet\vav}% \else% \Remainder{#1}{10}{\count0 }% \divide #1 by 10 % \ifnum\count0 = 0% \strcat{\HY}{\TensInHebrewEnd{#1}}% \else% \strcat{\HY}{\TensInHebrew{#1}}% \strcat{\HY}{\DigitInHebrew{\count0 }}% \fi% \fi% \fi% \fi% \countdef\HYLength=0 % \HYLength==\count0 = strlen(\HY) \HYLength =0 \expandafter\getlength\HY\end% \ifnum\HYLength > 0 % \ifnum\HYLength = 1 % \HY\HebrewYearChar% \else% \expandafter\Insert\HY% \fi% \else% \relax% \fi}} \def\HebrewYearName#1{{% \count2 = #1% \Remainder{\count2}{10000}{#1}% macro only for year <= 9999 \count2 = #1% \Remainder{\count2}{1000}{#1}% E.g., for 5752: #1 = 752 \divide \count2 by 1000 % E.g., for 5752: \count2 = 5 \countdef\thousand=2 % \thousand==\count2 \def\Thousands{}% the string of thousands \strcat{\Thousands}{\DigitInHebrew{\thousand }}% output 1000' \ifnum\thousand = 5 % Change it in the next Hebrew Millennium.. \ifnum#1 > 0 % if 5000 < year < 6000 \def\Thousands{}% don't mention thousands \fi% \fi% \countdef\ThousandsLength=0 % % \ThousandsLength==\count0 = strlen(\Thousands) \ThousandsLength =0 \expandafter\getlength\Thousands\end% % if the letter of thousands is not empty \ifnum\ThousandsLength > 0 \strcat{\Thousands}{'}% add ' \fi% \def\HY{\ShortHYName{#1}}% the string of hundreds, tens and ones \def\PratGadol{}% An additional string to date. Default: empty \ifnum\thousand < 1% \def\PratGadol{\ )\lamed\pe"\gimel(}% \fi% \ifnum #1 = 0% \def\PratGadol{\ )\lamed\pe"\gimel(}% \fi% \Thousands\HY\PratGadol}} \def\HebrewMonthName#1#2{% \ifnum #1 = 7 % \CheckLeapHebrewYear{#2}% \if@HebrewLeap \alef\dalet\resh\ \bet'% \else \alef\dalet\resh% \fi% \else% \ifcase#1% % nothing for 0 \or\tav\shin\resh\yod% \or\het\shin\vav\finalnun% \or\kaf\samekh\lamed\vav% \or\tet\bet\tav% \or\shin\bet\tet% \or\alef\dalet\resh\ \alef'% \or\alef\dalet\resh\ \bet'% \or\nun\yod\samekh\finalnun% \or\alef\yod\yod\resh% \or\samekh\yod\vav\finalnun% \or\tav\mem\vav\zayin% \or\alef\bet% \or\alef\lamed\vav\lamed% \fi% \fi} \def\HebrewDayName#1{% \ifcase#1% % nothing for 0 \or\alef'% \or\bet'% \or\gimel'% \or\dalet'% \or\he'% \or\vav'% \or\zayin'% \or\het'% \or\tet'% \or\yod'% \or\yod''\alef% \or\yod''\bet% \or\yod''\gimel% \or\yod''\dalet% \or\tet''\vav% \or\tet''\zayin% \or\yod''\zayin% \or\yod''\het% \or\yod''\tet% \or\kaf'% \or\kaf''\alef% \or\kaf''\bet% \or\kaf''\gimel% \or\kaf''\dalet% \or\kaf''\he% \or\kaf''\vav% \or\kaf''\zayin% \or\kaf''\het% \or\kaf''\tet% \or\lamed'% \or\lamed''\alef% \fi} \def\DigitInHebrew#1{% \ifcase#1% % nothing for 0 \or\alef% 1 \or\bet% 2 \or\gimel% 3 \or\dalet% 4 \or\he% 5 \or\vav% 6 \or\zayin% 7 \or\het% 8 \or\tet% 9 \fi} \def\TensInHebrew#1{% \ifcase #1% % nothing for 0 \or\yod% 10 \or\kaf% 20 \or\lamed% 30 \or\mem% 40 \or\nun% 50 \or\samekh% 60 \or\ayin% 70 \or\pe% 80 \or\tsadi% 90 \fi} \def\TensInHebrewEnd#1{% \ifcase #1% % nothing for 0 \or\yod% 10 \or\finalkaf% 20 \or\lamed% 30 \or\finalmem% 40 \or\finalnun% 50 \or\samekh% 60 \or\ayin% 70 \or\finalpe% 80 \or\finaltsadi% 90 \fi} \def\FormatForHebrew#1#2#3{% \HebrewDayName{#1}~\bet\HebrewMonthName{#2}{#3},~\HebrewYearName{#3}} \def\HebrewMonthNameInEnglish#1#2{% \ifnum #1 = 7% \CheckLeapHebrewYear{#2}% \if@HebrewLeap Adar II\else Adar\fi% \else% \ifcase #1% % nothing for 0 \or Tishrei% \or Heshvan% \or Kislev% \or Tebeth% \or Shebat% \or Adar I% \or Adar II% \or Nisan% \or Iyar% \or Sivan% \or Tammuz% \or Av% \or Elul% \fi \fi} \def\FormatForEnglish#1#2#3{% \HebrewMonthNameInEnglish{#2}{#3} \number#1,\ \number#3} \newcount\@common \def\Remainder#1#2#3{% #3 = #1% % c = a \divide #3 by #2% % c = a/b \multiply #3 by -#2% % c = -b(a/b) \advance #3 by #1}% % c = a - b(a/b) \newif\if@Divisible \def\CheckIfDivisible#1#2{% {% \countdef\tmp = 0% \tmp == \count0 - temporary variable \Remainder{#1}{#2}{\tmp}% \ifnum \tmp = 0% \global\@Divisibletrue% \else% \global\@Divisiblefalse% \fi}} \def\strcat#1#2{\edef#1{#1#2}} \def\getlength#1{% \ifx#1\end% \let\next=\relax% \else% \advance\count0 by 1% \let\next=\getlength% \fi% \next} \def\Insert#1{% \ifnum\count0 = 1% #1% \let\next=\relax% \else% #1% \ifnum\count0 = 2% "% \fi \advance\count0 by -1% \let\next=\Insert% \fi% \next} \def\ifundefined#1{\expandafter\ifx\csname#1\endcsname\relax} \newif\if@GregorianLeap \def\IfGregorianLeap#1{% \CheckIfDivisible{#1}{4}% \if@Divisible% \CheckIfDivisible{#1}{100}% \if@Divisible% \CheckIfDivisible{#1}{400}% \if@Divisible% \@GregorianLeaptrue% \else% \@GregorianLeapfalse% \fi% \else% \@GregorianLeaptrue% \fi% \else% \@GregorianLeapfalse% \fi% \if@GregorianLeap} \def\GregorianDaysInPriorMonths#1#2#3{% {% #3 = \ifcase #1% 0 \or% % no month number 0 0 \or% 31 \or% 59 \or% 90 \or% 120 \or% 151 \or% 181 \or% 212 \or% 243 \or% 273 \or% 304 \or% 334% \fi% \IfGregorianLeap{#2}% \ifnum #1 > 2% % if month after February \advance #3 by 1% % add leap day \fi% \fi% \global\@common = #3} #3 = \@common} \def\GregorianDaysInPriorYears#1#2{% {% \countdef\tmpc = 4% % \tmpc==\count4 \countdef\tmpb = 2% % \tmpb==\count2 \tmpb = #1% % \advance \tmpb by -1% % \tmpc = \tmpb% % \tmpc = \tmpb = year-1 \multiply \tmpc by 365% % Days in prior years = #2 = \tmpc% % = 365*(year-1) ... \tmpc = \tmpb% % \divide \tmpc by 4% % \tmpc = (year-1)/4 \advance #2 by \tmpc% % ... plus Julian leap days ... \tmpc = \tmpb% % \divide \tmpc by 100% % \tmpc = (year-1)/100 \advance #2 by -\tmpc% % ... minus century years ... \tmpc = \tmpb% % \divide \tmpc by 400% % \tmpc = (year-1)/400 \advance #2 by \tmpc% % ... plus 4-century years. \global\@common = #2} #2 = \@common} \def\AbsoluteFromGregorian#1#2#3#4{% {% \countdef\tmpd = 0% % \tmpd==\count0 #4 = #1% % days so far this month \GregorianDaysInPriorMonths{#2}{#3}{\tmpd}% \advance #4 by \tmpd% % add days in prior months \GregorianDaysInPriorYears{#3}{\tmpd}% \advance #4 by \tmpd% % add days in prior years \global\@common = #4} #4 = \@common} \newif\if@HebrewLeap \def\CheckLeapHebrewYear#1{% {% \countdef\tmpa = 0% % \tmpa==\count0 \countdef\tmpb = 1% % \tmpb==\count1 \tmpa = #1% \multiply \tmpa by 7% \advance \tmpa by 1% \Remainder{\tmpa}{19}{\tmpb}% \ifnum \tmpb < 7% % \tmpb = (7*year+1)%19 \global\@HebrewLeaptrue% \else% \global\@HebrewLeapfalse% \fi}} \def\HebrewElapsedMonths#1#2{% {% \countdef\tmpa = 0% % \tmpa==\count0 \countdef\tmpb = 1% % \tmpb==\count1 \countdef\tmpc = 2% % \tmpc==\count2 \tmpa = #1% % \advance \tmpa by -1% % #2 = \tmpa% % #2 = \tmpa = year-1 \divide #2 by 19% % Number of complete Meton cycles \multiply #2 by 235% % #2 = 235*((year-1)/19) \Remainder{\tmpa}{19}{\tmpb}% \tmpa = years%19-years this cycle \tmpc = \tmpb% % \multiply \tmpb by 12% % \advance #2 by \tmpb% % add regular months this cycle \multiply \tmpc by 7% % \advance \tmpc by 1% % \divide \tmpc by 19% % \tmpc = (1+7*((year-1)%19))/19 - \advance #2 by \tmpc% % add leap months \global\@common = #2} #2 = \@common} \def\HebrewElapsedDays#1#2{% {% \countdef\tmpa = 0% % \tmpa==\count0 \countdef\tmpb = 1% % \tmpb==\count1 \countdef\tmpc = 2% % \tmpc==\count2 \HebrewElapsedMonths{#1}{#2}% \tmpa = #2% % \multiply \tmpa by 13753% % \advance \tmpa by 5604% % \tmpa=MonthsElapsed*13758 + 5604 \Remainder{\tmpa}{25920}{\tmpc}% \tmpc == ConjunctionParts \divide \tmpa by 25920% \multiply #2 by 29% \advance #2 by 1% \advance #2 by \tmpa% % #2 = 1 + MonthsElapsed*29 + \Remainder{#2}{7}{\tmpa}% % \tmpa == DayOfWeek \ifnum \tmpc < 19440% \ifnum \tmpc < 9924% \else% % New moon at 9 h. 204 p. or later \ifnum \tmpa = 2% % on Tuesday ... \CheckLeapHebrewYear{#1}% of a common year \if@HebrewLeap% \else% \advance #2 by 1% \fi% \fi% \fi% \ifnum \tmpc < 16789% \else% % New moon at 15 h. 589 p. or later \ifnum \tmpa = 1% % on Monday ... \advance #1 by -1% \CheckLeapHebrewYear{#1}% at the end of leap year \if@HebrewLeap% \advance #2 by 1% \fi% \fi% \fi% \else% \advance #2 by 1% % new moon at or after midday \fi% \Remainder{#2}{7}{\tmpa}% % \tmpa == DayOfWeek \ifnum \tmpa = 0% % if Sunday ... \advance #2 by 1% \else% % \ifnum \tmpa = 3% % Wednesday ... \advance #2 by 1% \else% \ifnum \tmpa = 5% % or Friday \advance #2 by 1% \fi% \fi% \fi% \global\@common = #2} #2 = \@common} \def\DaysInHebrewYear#1#2{% {% \countdef\tmpe = 12% % \tmpe==\count12 \HebrewElapsedDays{#1}{\tmpe}% \advance #1 by 1% \HebrewElapsedDays{#1}{#2}% \advance #2 by -\tmpe% \global\@common = #2} #2 = \@common} \def\HebrewDaysInPriorMonths#1#2#3{% {% \countdef\tmpf= 14% % \tmpf==\count14 #3 = \ifcase #1% % Days in prior month of regular year 0 \or% % no month number 0 0 \or% % Tishri 30 \or% % Heshvan 59 \or% % Kislev 89 \or% % Tebeth 118 \or% % Shebat 148 \or% % Adar I 148 \or% % Adar II 177 \or% % Nisan 207 \or% % Iyar 236 \or% % Sivan 266 \or% % Tammuz 295 \or% % Av 325 \or% % Elul 400% % Dummy \fi% \CheckLeapHebrewYear{#2}% \if@HebrewLeap% % in leap year \ifnum #1 > 6% % if month after Adar I \advance #3 by 30% % add 30 days \fi% \fi% \DaysInHebrewYear{#2}{\tmpf}% \ifnum #1 > 3% \ifnum \tmpf = 353% % \advance #3 by -1% % \fi% % Short Kislev \ifnum \tmpf = 383% % \advance #3 by -1% % \fi% % \fi% \ifnum #1 > 2% \ifnum \tmpf = 355% % \advance #3 by 1% % \fi% % Long Heshvan \ifnum \tmpf = 385% % \advance #3 by 1% % \fi% % \fi% \global\@common = #3} #3 = \@common} \def\AbsoluteFromHebrew#1#2#3#4{% {% #4 = #1% \HebrewDaysInPriorMonths{#2}{#3}{#1}% \advance #4 by #1% % Add days in prior months this year \HebrewElapsedDays{#3}{#1}% \advance #4 by #1% % Add days in prior years \advance #4 by -1373429% % Subtract days before Gregorian \global\@common = #4} % 01.01.0001 #4 = \@common} \def\HebrewFromGregorian#1#2#3#4#5#6{% {% \countdef\tmpx= 17% % \tmpx==\count17 \countdef\tmpy= 18% % \tmpy==\count18 \countdef\tmpz= 19% % \tmpz==\count19 #6 = #3% % \global\advance #6 by 3761% approximation from above \AbsoluteFromGregorian{#1}{#2}{#3}{#4}% \tmpz = 1 \tmpy = 1% \AbsoluteFromHebrew{\tmpz}{\tmpy}{#6}{\tmpx}% \ifnum \tmpx > #4% % \global\advance #6 by -1% Hyear = Gyear + 3760 \AbsoluteFromHebrew{\tmpz}{\tmpy}{#6}{\tmpx}% \fi% % \advance #4 by -\tmpx% % Days in this year \advance #4 by 1% % #5 = #4% % \divide #5 by 30% % Approximation for month from below \loop% % Search for month \HebrewDaysInPriorMonths{#5}{#6}{\tmpx}% \ifnum \tmpx < #4% \advance #5 by 1% \tmpy = \tmpx% \repeat% \global\advance #5 by -1% \global\advance #4 by -\tmpy}} %% %% \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 \~} %% \endinput %% %% End of file `hebcal.sty'.