[texhax] reversing the order of columns in array package

Vafa Khalighi vafak9 at gmail.com
Wed May 6 14:21:47 CEST 2009

I wrote some macros to enable RTL in tabular evnvironments in LATeX:

\newif\if at tabsw
\def\@tabular{\if at RTL\global\@tabswtrue\fi
     \leavevmode \hbox \bgroup \if at tabsw\beginR \fi
     \let\@classiv\@tabclassiv \let\\\@tabularcr\@tabarray}
\def\endtabular{\crcr\egroup\if at tabsw\egroup\endR\egroup\fi
         \egroup $\if at tabsw\endR\fi \egroup
\expandafter \let \csname endtabular*\endcsname = \endtabular

     height\arraystretch \ht\strutbox
     depth\arraystretch \dp\strutbox
\halign \noexpand\@halignto
\bgroup \tabskip\z@ \@arstrut \@preamble \tabskip\z@ \cr}%
\let\@startpbox\@@startpbox \let\@endpbox\@@endpbox
\if #1t\vtop \else \if#1b\vbox \else \vcenter \fi\fi
\bgroup \let\par\relax
\let\@sharp##\let\protect\relax \lineskip\z@\baselineskip\z@
\if at tabsw\hbox\bgroup\beginR\vbox\bgroup\fi

That code just works fine but if I load array package, In array package the
columns in tabular environment is always typeset from left to right even if
you enable some bidi macros. Does any one know how can I reverse columns in
the tabular environments in array package so that columns are actually
typeset from right to left instead being typeset from left to right.

I have tried very hard for a week but came with no success. Can you please
if you can help me? Can you also if  you can look at the bidi code (the
above code) I wrote for  LaTeX tabular environments and give me some

Also making each entry in a cell being RTL sounds easy like I could have

\let\origin at insert@column=\insert at column
\def\insert at column{\if at RTL\beginR\fi\origin at insert@column\if at RTL\endR\fi}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://tug.org/pipermail/texhax/attachments/20090506/a7be1109/attachment.html 

More information about the texhax mailing list