<div dir="ltr">Hello Today I wrote a hack for longtable.sty that it actually makes longtable typeset RTL tables which means it can typeset columns from right to left and each entry in the cell will be written from right to left. This is done by assuming only \beginR, and \endR primitives. This is my code<br>
<br>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br>\newif\if@RTLtab<br>\global\@RTLtabfalse<br>\def\LT@makecaption#1#2#3{%<br>  \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\LTcapwidth{%<br>    \sbox\@tempboxa{\if@RTL\beginR\fi#1{#2: }#3\if@RTL\endR\fi}%<br>
    \ifdim\wd\@tempboxa&gt;\hsize<br>      #1{#2: }#3%<br>    \else<br>      \hbox to\hsize{\hfil\box\@tempboxa\hfil}%<br>    \fi<br>    \endgraf\vskip\baselineskip}%<br>  \hss}}}<br><br>\def\longtable{\if@RTL\global\@RTLtabtrue\fi%<br>
  \par<br>  \ifx\multicols\@undefined<br>  \else<br>     \ifnum\col@number&gt;\@ne<br>       \@twocolumntrue<br>     \fi<br>  \fi<br>  \if@twocolumn<br>    \LT@err{longtable not in 1-column mode}\@ehc<br>  \fi<br>  \begingroup \if@RTLtab\beginR \fi<br>
  \@ifnextchar[\LT@array{\LT@array[x]}}<br><br>\def\LT@array[#1]#2{%<br>  \refstepcounter{table}\stepcounter{LT@tables}%<br>  \if l#1%<br>    \LTleft\z@ \LTright\fill<br>  \else\if r#1%<br>    \LTleft\fill \LTright\z@<br>
  \else\if c#1%<br>    \LTleft\fill \LTright\fill<br>  \fi\fi\fi<br>  \let\LT@mcol\multicolumn<br>  \let\LT@@tabarray\@tabarray<br>  \let\LT@@hl\hline<br>  \def\@tabarray{%<br>    \let\hline\LT@@hl<br>    \LT@@tabarray}%<br>
  \let\\\LT@tabularcr\let\tabularnewline\\%<br>  \def\newpage{\noalign{\break}}%<br>  \def\pagebreak{\noalign{\ifnum`}=0\fi\@testopt{\LT@no@pgbk-}4}%<br>  \def\nopagebreak{\noalign{\ifnum`}=0\fi\@testopt\LT@no@pgbk4}%<br>
  \let\hline\LT@hline \let\kill\LT@kill\let\caption\LT@caption<br>  \@tempdima\ht\strutbox<br>  \let\@endpbox\LT@endpbox<br>  \ifx\extrarowheight\@undefined<br>    \let\@acol\@tabacol<br>    \let\@classz\@tabclassz \let\@classiv\@tabclassiv<br>
    \def\@startpbox{\vtop\LT@startpbox}%<br>    \let\@@startpbox\@startpbox<br>    \let\@@endpbox\@endpbox<br>    \let\LT@LL@FM@cr\@tabularcr<br>  \else<br>    \advance\@tempdima\extrarowheight<br>    \col@sep\tabcolsep<br>
    \let\@startpbox\LT@startpbox\let\LT@LL@FM@cr\@arraycr<br>  \fi<br>  \setbox\@arstrutbox\hbox{\vrule<br>    \@height \arraystretch \@tempdima<br>    \@depth \arraystretch \dp \strutbox<br>    \@width \z@}%<br>  \let\@sharp##\let\protect\relax<br>
   \begingroup<br>    \@mkpream{#2}%<br>    \xdef\LT@bchunk{%<br>       \global\advance\c@LT@chunks\@ne<br>       \global\LT@rows\z@\setbox\z@\vbox\bgroup<br>       \LT@setprevdepth<br>       \tabskip\LTleft \noexpand\halign to\hsize\bgroup<br>
      \tabskip\z@ \@arstrut \@preamble \tabskip\LTright \cr}%<br>  \endgroup<br>  \expandafter\LT@nofcols\LT@bchunk&amp;\LT@nofcols<br>  \LT@make@row<br>  \m@th\let\par\@empty<br>  \everycr{}\lineskip\z@\baselineskip\z@<br>
  \if@RTLtab\hbox\bgroup\beginR\vbox\bgroup\fi<br>  \LT@bchunk}<br><br><br>\def\endlongtable{%<br>  \crcr<br>  \noalign{%<br>    \let\LT@entry\LT@entry@chop<br>    \xdef\LT@save@row{\LT@save@row}}%<br>  \LT@echunk<br>  \LT@start<br>
  \unvbox\z@<br>  \LT@get@widths<br>  \if@filesw<br>    {\let\LT@entry\LT@entry@write\immediate\write\@auxout{%<br>      \gdef\expandafter\noexpand<br>        \csname LT@\romannumeral\c@LT@tables\endcsname<br>          {\LT@save@row}}}%<br>
  \fi<br>  \ifx\LT@save@row\LT@@save@row<br>  \else<br>    \LT@warn{Column \@width s have changed\MessageBreak<br>             in table \thetable}%<br>    \LT@final@warn<br>  \fi<br>  \endgraf\penalty -\LT@end@pen<br>  \egroup\if@RTLtab\endR\egroup\fi<br>
   \if@RTLtab\endR\fi \endgroup<br>  \global\@mparbottom\z@<br>  \pagegoal\vsize<br>  \endgraf\penalty\z@\addvspace\LTpost<br>  \ifvoid\footins\else\insert\footins{}\fi<br>   \global\@RTLtabfalse}<br>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br>
<br><br>Now this code makes longtable.sty typeset tables from right to left. But it unfortunately does not make longtable to break table when a page is finished. For eaxmple I have attached a tex file and its pdf output.<br>
<br><br>Can you please tell me how can I solve the issue?<br><br>Thanks<br></div>