# How to get longtable and bidi to work together?

I am typesetting a Hebrew document using bidi. The material in the longtable environment still comes out LTR. How do I make it work?

\documentclass{article}
\usepackage{longtable}
\usepackage[no-sscript]{xltxtra} % loads fixltx2e, metalogo, xunicode, fontspec

\setmainfont{FreeSans}
\usepackage[rldocument]{bidi}

\begin{document}
\begin{center}
\begin{longtable}{@{\extracolsep{\fill}}llr}
\hline
מילה עברית&English Words&123, 456\\
\hline
English Text&מילים בעברית&12 3456\\
\hline
1234 56.&More English&עוד עברית\\
\hline
\end{longtable}

מילה עברית English Words 123, 456\\
English Text מילים בעברית 12 3456\\
1234 56. More English עוד עברית\
\end{center}
\end{document}


Here are the lines from the output which describe the software and package versions I'm using:

This is XeTeX, Version 3.1415926-2.4-0.9998 (TeX Live 2012)
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, uk
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
bidi package (Support for bidirectional typesetting in plain TeX and LaTeX)
v11.149, 2012/01/01

• ah. The maintainer of bidi contacted me a while back about that. It doesn't work I need to add some hooks to longtable but it isn't exactly clear where. (I thought it was clear but when I tried it it didn't work, I need to get back to it). Sorry about that. (If anyone else answers could they ping me either through the @ mechanism here or via email) – David Carlisle Aug 16 '12 at 22:03
• @DavidCarlisle And Vafa is unfortunately no longer maintaining bidi. – Alan Munn Aug 16 '12 at 22:11
• @AlanMunn Oh it was only last month he mailed me? – David Carlisle Aug 16 '12 at 22:12
• @DavidCarlisle He sent mail announcing it to the XeTeX list on Aug 5. – Alan Munn Aug 16 '12 at 22:20
• Yes, I tried sending e-mail to Vafa, but I got back and 'e-mail address does not exist' from google. – Aryeh Leib Taurog Aug 17 '12 at 3:50

Try developing final version of bidi package. It provides an experimental bidi-longtable package.

• Thank you! I've tried it with a few documents and it seems to work quite well. – Aryeh Leib Taurog Oct 25 '12 at 13:39

You could add the necessary commands to switch directions manually:

\documentclass{article}
\usepackage{longtable}
\usepackage[no-sscript]{xltxtra} % loads fixltx2e, metalogo, xunicode, fontspec

\setmainfont{Arial Unicode MS}
\usepackage[rldocument]{bidi}

\begin{document}
\begin{longtable}{@{\extracolsep{\fill}}llr}
\hline
מילה עברית&English Words&123, 456\\
\beginR מילה עברית\endR &English Words&123, 456\\
\RL{מילה עברית} &English Words&123, 456\\
\end{longtable}
\end{document}

• I was afraid that would be the answer. At least \usepackage{array} \newcolumntype{R}{>{\beginR}r<{\endR}} seems to work. Is there any difference here between the \beginR primitive and \RL{}? Is there no way to get xetex to start the columns on the right side, aside from entering them in reverse order? – Aryeh Leib Taurog Aug 19 '12 at 6:49