%%
%% This is file `bidi-longtable.sty'.
%% 
%%   ______________________________________
%%   Copyright © 2009–2013  Vafa Khalighi
%% 
%%   License information appended.
%% 
%% 
\ProvidesPackage{bidi-longtable}[2012/12/12 v0.1 typesetting bidi longtables in XeTeX engine (experimental)]
\def\longtable{\if@RTL\@RTLtabtrue\fi%
  \par
  \ifx\multicols\@undefined
  \else
     \ifnum\col@number>\@ne
       \@twocolumntrue
     \fi
  \fi
  \if@twocolumn
    \LT@err{longtable not in 1-column mode}\@ehc
  \fi
  \begingroup
  \@ifnextchar[\LT@array{\LT@array[x]}}
\def\endlongtable{%
  \crcr
  \noalign{%
    \let\LT@entry\LT@entry@chop
    \xdef\LT@save@row{\LT@save@row}}%
  \LT@echunk
  \LT@start
  \unvbox\z@
  \LT@get@widths
  \if@filesw
    {\let\LT@entry\LT@entry@write\immediate\write\@auxout{%
      \gdef\expandafter\noexpand
        \csname LT@\romannumeral\c@LT@tables\endcsname
          {\LT@save@row}}}%
  \fi
  \ifx\LT@save@row\LT@@save@row
  \else
    \LT@warn{Column \@width s have changed\MessageBreak
             in table \thetable}%
    \LT@final@warn
  \fi
  \endgraf\penalty -\LT@end@pen
  \endgroup
  \global\@mparbottom\z@
  \pagegoal\vsize
  \endgraf\penalty\z@\addvspace\LTpost
  \ifvoid\footins\else\insert\footins{}\fi\@RTLtabfalse}
\def\LT@output{%
  \ifnum\outputpenalty <-\@Mi
    \ifnum\outputpenalty > -\LT@end@pen
      \LT@err{floats and marginpars not allowed in a longtable}\@ehc
    \else
      \setbox\z@\vbox{\unvbox\@cclv}%
      \ifdim \ht\LT@lastfoot>\ht\LT@foot
        \dimen@\pagegoal
        \advance\dimen@-\ht\LT@lastfoot
        \ifdim\dimen@<\ht\z@
          \setbox\@cclv\vbox{\unvbox\z@\copy\LT@foot\vss}%
          \@makecol
          \@outputpage
          \setbox\z@\vbox{\box\LT@head}%
        \fi
      \fi
      \global\@colroom\@colht
      \global\vsize\@colht
      \vbox
        {\hbox{\if@RTLtab\beginR\fi\vbox{\unvbox\z@\box\ifvoid\LT@lastfoot\LT@foot\else\LT@lastfoot\fi}\if@RTLtab\endR\fi}}%
    \fi
  \else
    \setbox\@cclv\vbox{\hbox{\if@RTLtab\beginR\fi\vbox{\unvbox\@cclv\copy\LT@foot\vss}\if@RTLtab\endR\fi}}%
    \@makecol
    \@outputpage
      \global\vsize\@colroom
    \copy\LT@head\nobreak
  \fi}
%% 
%% Copyright © 2009–2013  Vafa Khalighi <vafakh@me.com>
%% 
%% It may be distributed and/or modified under the LaTeX Project Public License,
%% version 1.3c or higher (your choice). The latest version of
%% this license is at: http://www.latex-project.org/lppl.txt
%% 
%% This work is “maintained” (as per LPPL maintenance status)
%% by Vafa Khalighi.
%% 
%% 
%% 
%%
%% End of file `bidi-longtable.sty'.
