From 426fd91e25f4a435712b4d9730413b74f4db376f Mon Sep 17 00:00:00 2001
From: Robert Alessi <alessi@robertalessi.net>
Date: Mon, 22 Feb 2016 15:45:01 +0100
Subject: (re)define \LR{} \AtBeginDocument{} in case luabidi is loaded

---
 arabluatex.dtx | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

(limited to 'arabluatex.dtx')

diff --git a/arabluatex.dtx b/arabluatex.dtx
index 847bb2e..72792db 100644
--- a/arabluatex.dtx
+++ b/arabluatex.dtx
@@ -187,20 +187,20 @@
 \RequirePackage{environ}
 \luadirect{dofile(kpse.find_file("arabluatex.lua"))}
 %    \end{macrocode}
-% This is needed by the current version of \package{luabidi}.
+% This is needed by the current versions of \package{polyglossia} and
+% \package{luabidi}.  \package{luabidi} provides a \cs{Footnote}
+% command. Use it as well if it is loaded.
 %    \begin{macrocode}
 \luadirect{tex.enableprimitives("luatex",tex.extraprimitives("omega"))}
 %    \end{macrocode}
-% \package{luabidi} provides a \cs{Footnote} command. Use it for now.
-%    \begin{macrocode}
-\RequirePackage{luabidi}
-%    \end{macrocode}
 %    \begin{macrocode}
 \AtBeginDocument{\ifdefined\arabicfont\relax\else
 \PackageWarning{arabluatex}{\string\arabicfont\ is not defined!^^JI
   will try to load Amiri}%
 \newfontfamily\arabicfont[Script=Arabic]{Amiri}\fi}%
-\DeclareDocumentCommand{\LR}{+m}{\bgroup\textdir TLT\rmfamily#1\egroup}
+\AtBeginDocument{\ifdef{\LR}%
+  {\renewrobustcmd{\LR}[1]{\bgroup\textdir TLT\rmfamily#1\egroup}}
+  {\newrobustcmd{\LR}[1]{\bgroup\textdir TLT\rmfamily#1\egroup}}}
 \DeclareDocumentCommand{\txarb}{+m}{\bgroup\textdir TRT\arabicfont#1\egroup}
 \DeclareDocumentCommand{\arb}{O{\al@mode} +m}%
 {\edef\@tempa{#1}%
-- 
cgit v1.2.3

