aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arabluatex.lua11
1 files changed, 10 insertions, 1 deletions
diff --git a/arabluatex.lua b/arabluatex.lua
index 435519c..292c01c 100644
--- a/arabluatex.lua
+++ b/arabluatex.lua
@@ -823,6 +823,15 @@ function tooutfile(str, nl)
823 return str 823 return str
824end 824end
825 825
826local function removespaceaftercmd(str)
827 str = gsub(str, cmd * spce^1 * bsqbracketsii * bcbraces, function(cmd, space, brackets, braces)
828 braces = string.sub(braces, 2, -2)
829 braces = removespaceaftercmd(braces)
830 return string.format("%s%s{%s}", cmd, brackets, braces)
831 end)
832 return str
833end
834
826function al_closestream() 835function al_closestream()
827 local f = io.open(tex.jobname..utffilesuffix.."_tmp.tex", "r") 836 local f = io.open(tex.jobname..utffilesuffix.."_tmp.tex", "r")
828 local o = io.open(tex.jobname..utffilesuffix..".tex", "w") 837 local o = io.open(tex.jobname..utffilesuffix..".tex", "w")
@@ -870,7 +879,7 @@ function al_closestream()
870 [[ and compile it one more time}}]]) 879 [[ and compile it one more time}}]])
871 -- 880 --
872 else end 881 else end
873 t = gsub(t, cmd * spce * cmdargs, "%1%3") 882 t = removespaceaftercmd(t)
874 t = t.."\n\\end{document}" 883 t = t.."\n\\end{document}"
875 io.write(t) 884 io.write(t)
876 o:write(t) 885 o:write(t)