%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% alatex.sty
% LaTeX extensions for ArabTeX
% 25.01.96
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% (c) Klaus Lagally
%     Institut fuer Informatik
%     Universitaet Stuttgart
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\ifx \a@@env \a@@LaTeX \else \xpa \endinput \fi

\a@ident {alatex.sty} 
{3.04 ArabTeX extensions for LaTeX commands } {25.01.96}

%%%%%%%%%%%%%%%%%%% modify \document command %%%%%%%%%%%%%%%%%%%%%%%%%%

\ifx \a@@var \a@@LaTeXiie
	\AtBeginDocument {\setarab}%
	\AtEndDocument {{\newlinechar `$ \wlog {\arabtexconfig $}}}%
\else
\let \a@document \document	\let \a@enddocument \enddocument

\def \document {% activate Arabic insertions
	\a@document \setarab } 

\def \enddocument {% report the configuration
	{\newlinechar `$ \wlog {\arabtexconfig $}}\a@enddocument }
\fi

%%%%%%%%%%%%%%%%%%% \footnote, patches for LaTeX %%%%%%%%%%%%%%%

% make LaTeX \footnote catcode-safe, like in Plain TeX

\def \@footnotetext {\insert \footins \bgroup
\edef \@currentlabel {\csname p@footnote\endcsname \@thefnmark }%
\interlinepenalty \interfootnotelinepenalty \floatingpenalty \@MM 
\splittopskip \footnotesep \splitmaxdepth \dp \strutbox \a@fntext }

\def \@mpfootnotetext {\global \setbox \@mpfootins \vbox \bgroup
\edef \@currentlabel {\csname p@mpfootnote\endcsname \@thefnmark }%
\unvbox \@mpfootins \reset@font \a@fntext }

\def \a@fntext {% common part for footnote text
\footnotesize \hsize \columnwidth \@parboxrestore 
\@makefntext {\rule {\z@ }{\footnotesep }}\futurelet \next \fo@t }

%%%%%%%%%%%%%%%%%%% \footnote, parts from Plain %%%%%%%%%%%%%%%

\def \fo@t {\ifcat \bgroup \noexpand \next \let \next \f@@t
\else \let \next \f@t \fi \next }

\def \f@@t {\bgroup \aftergroup \@foot \let \next }

\def \f@t #1{#1\@foot }

\def \@foot {\unskip \strut \egroup }

%%%%%%%%%%%%%%%%%%% \footnote in an arabic environment %%%%%%%%%%%%%%%

\def \a@c@footnote {% ArabTeX-LaTeX version
\def \@footnotemark {\a@spacefalse \putwordb@x \@makefnmark \a@spacetrue }%
\def \a@fntext {\a@@fntext }%
\footnote }

\def \a@@fntext #1{% common part for footnote text
\def \end {\a@par \egroup \test@token }%
\hsize \columnwidth \@parboxrestore 
\initlineb@x \@footnotemark \test@token #1 \end }

\def \a@c@footnotemark {\def \@footnotemark % ArabTeX-LaTeX version
{\a@spacefalse \putwordb@x \@makefnmark \a@spacetrue \test@token }%
\footnotemark }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% patch for LaTeX2e
% thanks to Andreas Scherer 
% <scherer@imib.rwth-aachen.de>

\def \verb {% make < safe
\ifx \undefined\documentclass % LaTeX 2.09
\begingroup \catcode ``=13 \tt 
\else
\relax \ifmmode \hbox \fi \bgroup \verbatim@font 
\fi
\catcode `<=12 \@noligs \let \do \@makeother \dospecials 
\@ifstar {\@sverb }{\@verb }}

%%%%%%%%%%%%%%%%%%%%%% enable LaTeX commands %%%%%%%%%%%%%%%%%%%%%%%%%%%

\all@wcmd \tiny         \all@wcmd \footnotesize \all@wcmd \small
\all@wcmd \normalsize   \all@wcmd \large        \all@wcmd \Large
\all@wcmd \LARGE        \all@wcmd \huge         \all@wcmd \Huge

\def \a@c@input {\expandafter \test@token \@@input }

\def \Arabic #1{\@Arabic {\@nameuse {c@#1}}}

\def \@Arabic #1{{\set@arabfont \xpa\number #1}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def \a@c@begin #1{% call \a@c@#1
\@ifundefined {a@c@#1}%
{\def \@tempa {\@latexerr {Environment #1 undefined}\@eha \test@token }}%
{\def \@tempa {\def \@currenvir {#1}\csname a@c@#1\endcsname }}%
\begingroup \let \end \a@@end \@endpefalse \@tempa }

\def \a@@end #1{% call \end#1
\csname end#1\endcsname \@checkend {#1}%
\if@endpe \global \let \@gtempa \@doendpe
\else \global \let \@gtempa \relax
\fi \endgroup \@gtempa
\test@token }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%\UsePackage {abidir} % bidirectional routines
%\UsePackage {abjad} % abjad numerals

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\endinput
%%%%%%%%%%%%%%%%%%%%%%%%%%%%% EOF %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
