From 636c09401c1b2a46fb9771b464add7373cea0533 Mon Sep 17 00:00:00 2001 From: Robert Alessi Date: Mon, 1 Jan 2024 09:41:39 +0100 Subject: arabluatex.ayah(): the number must be typeset LTR and come after the sign. (thanks to Khaled Hosny.) --- arabluatex.lua | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'arabluatex.lua') diff --git a/arabluatex.lua b/arabluatex.lua index 3d6ec80..114a569 100644 --- a/arabluatex.lua +++ b/arabluatex.lua @@ -204,10 +204,15 @@ local function arbnum(str) -- not used, see below return str end -local function indnum(str) - str = string.gsub(str, "([0-9%,%-%/]+)", function(num) - return string.reverse(num) - end) +local function indnum(str, dir) + if dir == "ltr" + then + -- do nothing + else + str = string.gsub(str, "([0-9%,%-%/]+)", function(num) + return string.reverse(num) + end) + end if indorarbnum == "Indian" then for i = 1,#numbers do @@ -1302,7 +1307,9 @@ end function arabluatex.ayah(str) if tonumber(str) ~= nil and str.len(str) < 4 then if tex.textdir == "TRT" then - str = indnum(str).."^^^^06dd" + -- end of ayah is typeset LTR and the number comes after the + -- sign (see https://github.com/aliftype/amiri/issues/263#issuecomment-1872979252) + str = "{\\textdir TLT ".."^^^^06dd"..indnum(str, "ltr").."}" elseif tex.textdir == "TLT" then str = "\\arb[trans]{("..str..")}" end -- cgit v1.2.3