Hello Frank


I did a hack to make tabular in array.sty RTL and this is what I have done

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass{article}
\usepackage{array}
\makeatletter
\TeXXeTstate=1
\def\@tabular{%
  \leavevmode
  \hbox \bgroup \beginR $\col@sep\tabcolsep \let\d@llarbegin\begingroup
                                    \let\d@llarend\endgroup
  \@tabarray}

\def\endarray{\crcr \egroup\egroup\endR\egroup \egroup \gdef\@preamble{}}
\def\endtabular{\endarray $\endR \egroup}
\expandafter\let\csname endtabular*\endcsname=\endtabular

\def\@array[#1]#2{%
  \@tempdima \ht \strutbox
  \advance \@tempdima by\extrarowheight
  \setbox \@arstrutbox \hbox{\vrule
             \@height \arraystretch \@tempdima
             \@depth \arraystretch \dp \strutbox
             \@width \z@}%
  \begingroup
  \@mkpream{#2}%
  \xdef\@preamble{\noexpand \ialign \@halignto
                  \bgroup \@arstrut \@preamble
                          \tabskip \z@ \cr}%
  \endgroup
  \@arrayleft
  \if #1t\vtop \else \if#1b\vbox \else \vcenter \fi \fi
  \bgroup
  \let \@sharp ##\let \protect \relax
  \lineskip \z@
  \baselineskip \z@
  \m@th
  \let\\\@arraycr \let\tabularnewline\\\let\par\@empty
\hbox\bgroup\beginR\vbox\bgroup
\@preamble}
\makeatother
\begin{document}
\begin{tabular}{|l|l|}\hline
vafa khalighi&shahrzad khalighi\\ \hline
\end{tabular}
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Now the macros that are shown in red are the ones that I have added. I have
done all my grouping correctly but when I compile this document with
pdflatex or xelatex, they complain about a missing or extra end group. I
have done the same kind of trick with several other tabular packages
including standard LaTeX tabular macros and they just work (if you like I
can send other documents where tabular works RTL with no problem) fine but I
have got no clue why when I have done my grouping correct, pdflatex or
xelatex complains about it.

can you please help me to get this fixed? I have been working on tabular
packages for a month full time and array is the only one that is annoying
too much.

Please note that in RTL we both want the order of columns to be RTL and each
entry in each cell to be RTL.

Frank, Please if you can help me I am hopeless. I have asked this in several
other places and still got no solution. It is driving me crazy that the
grouping does not work.

Thanks