# bidi's undefined environments in (my) LuaLaTeX system

I typeset Arabic text with LuaLaTeX. I am using the following definitions and it works nicely:

\newcommand{\arabtext}[1]       % Arabic inside LTR
{\bgroup\luatextextdir TRT\arabicfont #1\egroup}


(More expanded version here.)

A while ago, though, I've been told through a comment that "[my] definition ... is wrong" and that I might have a look at the bidi-package. Indeed I looked at it several times but never got it to work on my system. In fact, I can not even compile an example taken from the bidi-documentation itself:

% !TEX TS-program = lualatex
\documentclass{article}
\usepackage{fontspec}
\newfontfamily\Parsifont[Script=Arabic]{Arabic Typesetting}
\usepackage{bidi}
\begin{document}
\begin{RTL}
Anyone who reads Old and Middle English \LRE{Short LTR text} literary texts will be familiar with the mid-brown volumes of the EETS, with the symbol of Alfred's jewel embossed on the front cover.
\begin{LTR}
Anyone who reads Old and Middle English \RLE{Short RTL text} literary texts will be familiar with the mid-brown volumes of the EETS, with the symbol of Alfred's jewel embossed on the front cover.
\end{LTR}
\end{RTL}
\end{document}


The only result is LaTeX Error: Environment RTL undefined.

Why is that so? is bidi incompatible with LuaLaTeX?

I am asking, because I do believe that bidi could be a better solution than mine offered above (because, e.g., bidi has many other feature such as RTL footnotes etc.) and would like to try and to use it.

-
Nothing in the documentation suggests bidi can be used with LuaLaTeX. –  egreg Feb 7 '13 at 11:27
@egreg : my reading was that nothing suggests that it can't, either. Much more so, since the above mentioned comment that "[my] definition ... is wrong" (presumably written by the bidi-author himself?) IMHO seemed to justify the believe that it could be used with LuaLaTex. –  ClintEastwood Feb 7 '13 at 11:41
General question of efficiency: Why do documentations of packages not by default declare on the first page by which engines and processing methods (TeX, LaTeX2e, LuaLaTeX, XeTeX, etc.) they can be used?? –  ClintEastwood Feb 7 '13 at 11:44
The definition of \RTL and \endRTL are in xetex-bidi.def. There is a luatex-bidi.def file that simply enables some LuaTeX primitives, but doesn't define anything else. –  egreg Feb 7 '13 at 11:47

bidi is basically XeTeX-only: the author has moved his LuaTeX code to a (commercial) alternative. XeTeX and LuaTeX use different RTL models, so completely different approaches are needed at a low level. On the documentation side: this depends on the package author. I'd always include a test in the code, with appropriate warnings/errors, but not everyone does.