\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
\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=jerus10
\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
\font\hsl=rediss10
\font\hebrew=jerus10

\ifundefined{LaTeX}
{
\hebcheck=1
\hebtext =1
\def\hebR#1{\ifodd\hebcheck\beginR#1\fi}
\baselineskip=14pt
\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}

\let\ngxefzlerfiz=\L
\let\ngxefzraxiz=\R

% \hebrew = \raxiz
% The font Jerusalem = \ixeylim
% The font telav10   = \zlaia
% The font DeadSea   = \imdnlg
% The font OldJaffa  = \ite

%
% \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=jerus10 scaled 750
\let\who=\Jerfootnote

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

\font\Telfootnote=telav10 scaled 750

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

\font\Deadfootnote=deads10 scaled 750

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

\font\Jaffafootnote=oldjaf10 scaled 750

%\font\Jaffahalf=oldjaf10 scaled \magstephalf
%\font\Jaffaone=oldjaf10 scaled \magstep1
%\font\Jaffatwo=oldjaf10 scaled \magstep2
\font\Jaffathree=oldjaf10 scaled \magstep3
%\font\Jaffafour=oldjaf10 scaled \magstep4
\font\Jaffafive=oldjaf10 scaled \magstep5

\def\ixeylim{\font\hebrew=jerus10 \hebrew }
\def\zlaia{\font\hebrew=telav10  \hebrew }
\def\imdnlg{\font\hebrew=deads10  \hebrew }
\def\ite{\font\hebrew=oldjaf10 \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


%\font\biggestTel=telav10  scaled 7000
%\font\giantTel=telav10 scaled 13000

% 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 telav10).

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

\def\zlaiac{\font\hebrew=telav1010 scaled 7000 \hebrew }
\def\zlaiad{\font\hebrew=telav1020 scaled 13000 \hebrew }

\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\fi}
\def\hebrewtext{\everypar{\leavevmode\kern-\parindent\beginR\indent\the\font}
    \ifundefined{fmtname}{} \else \hebrew\fi
               \ifodd\hebcheck{}
                    \else\hebrew\fi
             \hebcheck=1 \hebtext=1 \hebtrue}
\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  \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\negspace{\hskip -3.5pt}      % From Samy Zafrany
\everydisplay{\aftergroup\negspace}  %  samy@techunix.technion.ac.il


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

\let\hebday=\diem
\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{\L{--}}
  \def\nwsrpw{\L{---}}
\let\makafgadol=\nwsbcel
\let\makafanak=\nwsrpw

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

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

\let\hadgesh=\dcby
\def\tiqwd#1{\item{#1}\hangindent=-\hangindent}
\def\tqwd#1{\item{#1}\hangindent=-\hangindent}
\let\piska=\tiqwd

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

\def\yexdinio#1{\line{\R{#1 \hss}}}
\def\yexdyn`l#1{\line{\R{\hss #1}}}
\def\nxkf#1{\line{\R{\hss #1 \hss}}}

  \def\bxy{\L{`}}
  \let\geresh=\bxy

\def\qbexbxy{\L{`}}
\let\closegeresh=\geresh

\def\tzgbxy{\L{\char39}}
\let\opengeresh=\tzgbxy

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

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

\let\tzgviheh=\openquote
\let\qbexviheh=\closequote

\input hebcal.tex
