\immediate\write10{        }
\immediate\write10{>>> heb_macros version 1.1                             <<<}
\immediate\write10{<<< Hebrew date -> hebrewtoday, regular date -> hebday >>>}
\immediate\write10{        }
%% Written by Rama Porrat of the Computation Center, 
%% Hebrew University of Jerusalem,
%% based upon Knuth's wisdom and Prof. Azriel levy's contributions.
%% 
\catcode`�=11\catcode`�=11\catcode`�=11\catcode`�=11
\catcode`�=11\catcode`�=11\catcode`�=11\catcode`�=11
\catcode`�=11\catcode`�=11\catcode`�=11\catcode`�=11
\catcode`�=11\catcode`�=11\catcode`�=11\catcode`�=11
\catcode`�=11\catcode`�=11\catcode`�=11\catcode`�=11
\catcode`�=11\catcode`�=11\catcode`�=11\catcode`�=11
\catcode`�=11\catcode`�=11\catcode`�=11

\lccode`�=``\lccode`�=`a\lccode`�=`b\lccode`�=`c
\lccode`�=`d\lccode`�=`e\lccode`�=`f\lccode`�=`g
\lccode`�=`h\lccode`�=`i\lccode`�=`k\lccode`�=`l
\lccode`�=`n\lccode`�=`p\lccode`�=`q\lccode`�=`r
\lccode`�=`t\lccode`�=`v\lccode`�=`w\lccode`�=`x
\lccode`�=`y\lccode`�=`z\lccode`�=`j\lccode`�=`m
\lccode`�=`o\lccode`�=`s\lccode`�=`u

\def\undertext#1{$\underline{\hbox{#1}}$}
\def\ifundefined#1{\expandafter\ifx\csname#1\endcsname\relax}
%
% this if is used to distinguish between a tex input and
% a latex input.
%
\font\Jer=Jerusalem_pccode
\ifundefined{LaTeX}
      \def\footnoterule{\kern-3pt\hrule width \hsize \kern 2.6pt}
\else \renewcommand\footnoterule{\kern-3pt\hrule width\hsize\kern 2.6pt}
\fi
\ifundefined{LaTeX}{} \newcount\hebcheck
                      % This counter used for local text being Hebrew.
\fi
\ifundefined{LaTeX}{} \newcount\hebtext 
                      % This counter used for overall text being Hebrew.
\fi
%
% Each control sequence defined here has his Hebrew equivalent.

% \L = ngxefzlerfiz
% \R = ngxefzraxiz

%\font\hrm=redis10   
%\font\hsl=rediss10

\ifundefined{LaTeX}
\hebcheck=1
\hebtext =1
\def\hebR#1{\ifodd\hebcheck\beginR#1\fi}
\baselineskip=14pt 
\font\hebrew=Jerusalem_pccode
\hebrew
\fi

\let\next=\ 

\def\L{\afterassignment\moreL \let\next= }
\def\moreL{\bracetext \aftergroup\endL \beginL \rm}
\def\R{\afterassignment\moreR \let\next= }
\def\moreR{\bracetext \aftergroup\endR \beginR \hebrew}
\def\bracetext{\ifcat\next{\else\ifcat\next}\fi
 \errmessage{Missing left brace has been substituted}\fi \bgroup}


% \hebrew is activated. Now the default is Jerusalem,
% and the \R control sequence refers to \hebrew.
% Thanx to the sequence 'ifundefined', it is possible
% to distinguish between latex and tex.
% Hence, for latex, hebrew is activated by
% hebrewtext, hebrewlines etc.
% For tex, instead of \hebrew it says \the\font, thus enabling
% any font (e.g. one called aaa) to be used and
% have the right indentation.
% The problem in latex lies in that
% \the\font in latex usually means \rm.
% Note that, still, the sequence \R still refers only to the font
% called \hebrew.

\font\Jerfootnote=Jerusalem_pccode scaled 750 
\let\katan=Jerfootnote
%\let\who=Jerfootnote

%\font\Jerhalf=Jerusalem_pccode scaled \magstephalf  
%\font\Jerone=Jerusalem_pccode scaled \magstep1
%\font\Jertwo=Jerusalem_pccode scaled \magstep2 
%\font\Jerthree=Jerusalem_pccode scaled \magstep3 
%\font\Jerfour=Jerusalem_pccode scaled \magstep4  
%\font\Jerfive=Jerusalem_pccode scaled \magstep5  

\font\Telfootnote=TelAviv_pccode scaled 750  

%\font\Telhalf=TelAviv_pccode scaled \magstephalf  
%\font\Telone=TelAviv_pccode scaled \magstep1  
%\font\Teltwo=TelAviv_pccode scaled \magstep2 
\font\Telthree=TelAviv_pccode scaled \magstep3  
%\font\Telfour=TelAviv_pccode scaled \magstep4  
\font\Telfive=TelAviv_pccode scaled \magstep5  

\font\Deadfootnote=DeadSea_pccode scaled 750  

%\font\Deadhalf=DeadSea_pccode scaled \magstephalf  
%\font\Deadone=DeadSea_pccode scaled \magstep1  
%\font\Deadtwo=DeadSea_pccode scaled \magstep2  
\font\Deadthree=DeadSea_pccode scaled \magstep3  
%\font\Deadfour=DeadSea_pccode scaled \magstep4  
\font\Deadfive=DeadSea_pccode scaled \magstep5  

\font\Jaffafootnote=OldJaffa_pccode scaled 750  

%\font\Jaffahalf=OldJaffa_pccode scaled \magstephalf  
%\font\Jaffaone=OldJaffa_pccode scaled \magstep1  
%\font\Jaffatwo=OldJaffa_pccode scaled \magstep2  
\font\Jaffathree=OldJaffa_pccode scaled \magstep3  
%\font\Jaffafour=OldJaffa_pccode scaled \magstep4  
\font\Jaffafive=OldJaffa_pccode scaled \magstep5  
 
\def\ixeylim{\font\hebrew=Jerusalem_pccode \hebrew }
\def\zlaia{\font\hebrew=TelAviv_pccode  \hebrew }
\def\imdnlg{\font\hebrew=DeadSea_pccode  \hebrew }
\def\ite{\font\hebrew=OldJaffa_pccode \hebrew }

% \let\Jer=\ixeylim
\let\Tel=\zlaia
\let\Dead=\imdnlg
\let\Jaffa=\ite 

\let\bigDead=\Deadthree
\let\biggerDead=\Deadfive  
\let\bigJer=\Jerthree
\let\biggerJer=\Jerfive  
\let\bigTel=\Telthree
\let\biggerTel=\Telfive  
\let\bigJaffa=\Jaffathree
\let\biggerJaffa=\Jaffafive  



% To use enlargements of Hebrew fonts by specifying Hebrew
% control sequences, use the Hebrew font name appended by bet or gimel
% (or dalet or he in TelAviv).

%\let\imdnlga=\bigDead 
%\let\imdnlgb=\biggerDead                                 
%\let\itea=\bigJaffa                                      
%\let\iteb=\biggerJaffa                                 
%\let\ixeylima=\bigJer                                       
%\let\ixeylimb=\biggerJer                                     
%\let\zlaiaa=\bigTel                                       
%\let\zlaiab=\biggerTel                                    

\ifundefined{LaTeX}
\def\nohebrewtext{\rm\everypar{}\hebcheck=0}
\fi

\ifundefined{LaTeX}
\def\hebrewpar{\noindent\beginR\indent\the\font
	       \ifodd\hebcheck{}\else\hebrew\hebcheck=1\fi}
\def\hebrewtext{\everypar{\leavevmode\kern-\parindent\beginR\indent\the\font} 
	       \ifodd\hebcheck{}\else\hebrew\fi
	                 \hebcheck=1 \hebtext=1}
\def\hebrewlines{\noindent\beginR\the\font 
	       \ifodd\hebcheck{}\else\hebrew\hebcheck=1\fi}
%\else
%\def\hebrewpar{\noindent\beginR\indent
%	       \ifodd\hebcheck{}\else\hebrew\hebcheck=1\fi}
%\def\hebrewtext{                                                   
%                     \ifodd\hebcheck{}
%		      \else\hebrew
%			 \fi
%               \everypar{\leavevmode\kern-\parindent\beginR\indent}
%	                 \hebcheck=1 \hebtext=1 }
%\def\hebrewlines{\noindent\beginR 
%	       \ifodd\hebcheck{}\else\hebrew\hebcheck=1\fi}
%\fi
%%  \def\hebrewtext{\everypar{\leavevmode\kern-\parindent\beginR\indent \hebrew }
%		 \hebcheck=1 \hebtext=1 }
%  \def\hebrewlines{\noindent\beginR \hebrew }
%  \def\hebrewpar{\noindent\beginR\indent \hebrew }
%
\fi

\let\sethebrew=\hebrewtext
\let\unsethebrew=\nohebrewtext

%\let\whrraxiz=\hebrewpar
%\let\hwqhraxiz=\hebrewtext
%\let\yexezraxiz\hebrewlines

\everydisplay{\aftergroup\beginR }   

\def\hebday{\L{\number\day}\ \hebrew a\ifcase\month\or 
\hebrew ipe`x\or
\hebrew taxe`x\or \hebrew nxq\or \hebrew `txil
\or \hebrew n`i\or \hebrew iepi\or \hebrew ieli\or 
\hebrew `ebeqh\or \hebrew qthnax\or \hebrew `ewheax
\or \hebrew peanax\or \hebrew cvnax\fi\
\L{\number\year}}

\let\diem=\hebday
%\def\wtivdwhpd{\smallskip }
%\def\wtivdaipepiz{\medskip }
%\def\wtivdbceld{\bigskip }
  
%  \def\wtivdlnhd #1{\vskip #1 }
%  \def\wtivddvicd #1{\hskip #1}
%\def\xeegaioyexez  #1{\baselineskip #1 }
  
  %\def\pw{ pt }
  %\def\pwecez{ pt }
  %\def\qes{\end }
  %\def\qn{ cm }

%  \def\nwsbcel{{\rm -- }}
%  \def\nwsrpw{{\rm --- }}

\def\hadgesh#1{\leavevmode\setbox0=\hbox{#1}%
\kern-.025em\copy0\kern-\wd0
\kern.05em\copy0\kern-\wd0
\kern-.025em\raise.0433em\box0 }

%\let\dcby=hadgesh

\def\dcbyy#1{\leavevmode\setbox0=\hbox{#1}%
\kern-.025em\copy0\kern-\wd0
\kern.05em\copy0\kern-\wd0
\kern-.025em\raise.0433em\box0\raise-.0433em\box0 }

\def\wewe#1{\leavevmode\setbox0=\hbox{#1}%
\kern-.025em\copy0\kern-\wd0
\kern.05em\box0 }   

%\def\tiqwd#1{\item{#1}\hangindent=-\hangindent}
%\def\tqwd#1{\item{#1}\hangindent=-\hangindent}

%\def\tiqwdtiqwd#1{\itemitem{#1}\hangindent=-\hangindent}
%\def\tqwdtqwd#1{\itemitem{#1}\hangindent=-\hangindent}

\def\piska#1{\item{#1}\hangindent=-\hangindent}

\def\piskapiska#1{\itemitem{#1}\hangindent=-\hangindent}
                      
\def\yexdinio#1{\line{\R{#1 \hss}}}
\def\yexdyn`l#1{\line{\R{\hss #1}}}
\def\nxkf#1{\line{\R{\hss #1 \hss}}}

\def\leftquotation{\L{''}}
\def\rightquotation{\L{``}}

\input hebcal.sty

