aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Alessi <alessi@robertalessi.net>2016-02-26 10:50:17 +0100
committerRobert Alessi <alessi@robertalessi.net>2016-02-26 10:50:17 +0100
commit029c8797e6e32adfcb79fc4c1f72377592c35f82 (patch)
treea0d4a348cb8b266d5afee8030ed07594376ce13d
parentf2911c64dda6d51f87791942660689e6d782b1f6 (diff)
downloadarabluatex-029c8797e6e32adfcb79fc4c1f72377592c35f82.tar.gz
(re)define \LR{} command \AtBeginDocument{} in case luabidi is loaded
-rw-r--r--arabluatex.dtx3
-rw-r--r--arabluatex.lua6
2 files changed, 9 insertions, 0 deletions
diff --git a/arabluatex.dtx b/arabluatex.dtx
index 67fa916..c0e1163 100644
--- a/arabluatex.dtx
+++ b/arabluatex.dtx
@@ -203,6 +203,9 @@
203\AtBeginDocument{\ifdef{\LR}% 203\AtBeginDocument{\ifdef{\LR}%
204 {\renewrobustcmd{\LR}[1]{\bgroup\textdir TLT\rmfamily#1\egroup}} 204 {\renewrobustcmd{\LR}[1]{\bgroup\textdir TLT\rmfamily#1\egroup}}
205 {\newrobustcmd{\LR}[1]{\bgroup\textdir TLT\rmfamily#1\egroup}}} 205 {\newrobustcmd{\LR}[1]{\bgroup\textdir TLT\rmfamily#1\egroup}}}
206\AtBeginDocument{\ifdef{\RL}%
207 {\renewrobustcmd{\RL}[1]{\bgroup\textdir TRT\rmfamily#1\egroup}}
208 {\newrobustcmd{\RL}[1]{\bgroup\textdir TRT#1\rmfamily\egroup}}}
206\DeclareDocumentCommand{\txarb}{+m}{\bgroup\textdir TRT\arabicfont#1\egroup} 209\DeclareDocumentCommand{\txarb}{+m}{\bgroup\textdir TRT\arabicfont#1\egroup}
207\DeclareDocumentCommand{\arb}{O{\al@mode} +m}% 210\DeclareDocumentCommand{\arb}{O{\al@mode} +m}%
208{\edef\@tempa{#1}% 211{\edef\@tempa{#1}%
diff --git a/arabluatex.lua b/arabluatex.lua
index f1aeda0..f0cfa78 100644
--- a/arabluatex.lua
+++ b/arabluatex.lua
@@ -40,6 +40,12 @@ return str
40end 40end
41 41
42local function breakcmd(str) 42local function breakcmd(str)
43 -- \RL
44 str = string.gsub(str, "\\(RL.-)(%b{})",
45 function(tag, body)
46 body = string.sub(body, 2, -2)
47 return string.format("}\\%s{%s}\\arb{", tag, body)
48 end)
43 -- \LR 49 -- \LR
44 str = string.gsub(str, "\\(LR.-)(%b{})", 50 str = string.gsub(str, "\\(LR.-)(%b{})",
45 function(tag, body) 51 function(tag, body)