\TeXXeTstate=1
\immediate\write10{        }
\immediate\write10{>>> heb_macros version 1.4                     <<<}
\immediate\write10{>>> New control sequences. Type tex hebrew_cs_guide     <<<}
\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.
%% 
\newif\ifheb
\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_newcode
\def\footnoterule{\kern-3pt\hrule width \hsize \kern 2.6pt}
\newcount\hebcheck
                      % This counter used for local text being Hebrew.
\newcount\hebtext 
                      % This counter used for overall text being Hebrew.
%
% Each control sequence defined here has his Hebrew equivalent.

% \L = ngxefzlerfiz
% \R = ngxefzraxiz

\font\hrm=redis10_newcode
\font\hsl=rediss10_newcode

\ifundefined{LaTeX}
\hebcheck=1\hebtrue
\hebtext =1
\def\hebR#1{\ifodd\hebcheck\beginR#1\fi}
\baselineskip=14pt 
\font\hebrew=Jerusalem_newcode
\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_newcode scaled 750 
\let\katan=\Jerfootnote
\let\קטן  =\Jerfootnote  
%\let\who=\Jerfootnote

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

\font\Telfootnote=TelAviv_newcode scaled 750  

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

\font\Deadfootnote=DeadSea_newcode scaled 750  

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

\font\Jaffafootnote=OldJaffa_newcode scaled 750  

%\font\Jaffahalf=OldJaffa_newcode scaled \magstephalf  
%\font\Jaffaone=OldJaffa_newcode scaled \magstep1  
%\font\Jaffatwo=OldJaffa_newcode scaled \magstep2  
\font\Jaffathree=OldJaffa_newcode scaled \magstep3  
%\font\Jaffafour=OldJaffa_newcode scaled \magstep4  
\font\Jaffafive=OldJaffa_newcode scaled \magstep5  
 
\def\ירושלים{\font\hebrew=Jerusalem_newcode \hebrew }
\def\תלביב{\font\hebrew=TelAviv_newcode  \hebrew }
\def\יםהמלח{\font\hebrew=DeadSea_newcode  \hebrew }
\def\יפו{\font\hebrew=OldJaffa_newcode \hebrew }

\let\Jer=\ירושלים
\let\Tel=\תלביב
\let\Dead=\יםהמלח
\let\Jaffa=\יפו 

\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\hebfalse}
\fi

\ifundefined{LaTeX}
\def\hebrewpar{\noindent\beginR\indent\the\font
	       \ifodd\hebcheck{}\else\hebrew\hebcheck=1\hebtrue\fi}
\def\hebrewtext{\everypar{\leavevmode\kern-\parindent\beginR\indent\the\font} 
	\ifundefined{fmtname}{} \else \hebrew\fi    
               \ifodd\hebcheck{}
                    \else\hebrew\fi
			 \hebcheck=1 \hebtrue\hebtext=1}
\def\hebrewlines{\noindent\beginR\the\font 
	       \ifodd\hebcheck{}\else\hebrew\hebcheck=1\hebtrue\fi}
%\else
%\def\hebrewpar{\noindent\beginR\indent
%	       \ifodd\hebcheck{}\else\hebrew\hebcheck=1\hebtrue\fi}
%\def\hebrewtext{                                                   
%                     \ifodd\hebcheck{}
%		      \else\hebrew
%			 \fi
%               \everypar{\leavevmode\kern-\parindent\beginR\indent}
%	                 \hebcheck=1\hebtrue \hebtext=1 }
%\def\hebrewlines{\noindent\beginR 
%	       \ifodd\hebcheck{}\else\hebrew\hebcheck=1\hebtrue\fi}
%\fi
%%  \def\hebrewtext{\everypar{\leavevmode\kern-\parindent\beginR\indent \hebrew }
%		 \hebcheck=1 \hebtext=1\hebtrue }
%  \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}\ \R{ב\ifcase\month\or 
 ינואר\or
 פברואר\or  מרץ\or  אפריל
\or  מאי \or  יוני\or  יולי\or 
 אוגוסט\or  ספטמבר\or  אוקטובר
\or  נובמבר\or  דצמבר \fi}\
\L{\number\year}}

\let\היום=\hebday
\def\קפיצהקטנה{\smallskip }
\def\קפיצהבינונית{\medskip }
\def\קפיצהגדולה{\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\מקףגדול{\L{--}}
\def\מקףענק{\L{---}}

\let\makafanak=\מקףענק
\let\makafgadol=\מקףגדול 

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

\let\הדגש=\hadgesh

\def\הדגשש#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\פיסקה#1{\item{#1}\hangindent=-\hangindent}
\def\פסקה#1{\item{#1}\hangindent=-\hangindent}

\def\פיסקהפיסקה#1{\itemitem{#1}\hangindent=-\hangindent}
\def\פסקהפסקה#1{\itemitem{#1}\hangindent=-\hangindent}

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

\def\piskapiska#1{\itemitem{#1}\hangindent=-\hangindent}
                      
\def\שורהימין#1{\line{\R{#1 \hss}}}
\def\שורהשמאל#1{\line{\R{\hss #1}}}
\def\מרכז#1{\line{\R{\hss #1 \hss}}}

  \def\גרש{\L{`}}
  \let\geresh=\גרש

\def\סגורגרש{\L{`}}
\let\closegeresh=\geresh

\def\פתחגרש{\L{\char39}}
\let\opengeresh=\פתחגרש

\def\openquote{\L{''}}
\def\closequote{\L{``}}

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

\let\פתחציטוט=\openquote
\let\סגורציטוט=\closequote

\input hebcal_newcode.tex

