From 5fbee7b562274cee955d2b8ba47fc84d04449059 Mon Sep 17 00:00:00 2001 From: Robert Alessi Date: Sun, 2 Apr 2017 11:13:12 +0200 Subject: new \Cap command that does the same as \cap but is never discarded; it is used internally to protect \cap when it is necessary --- arabluatex.dtx | 9 ++++++++- arabluatex.lua | 5 +++++ makefile | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/arabluatex.dtx b/arabluatex.dtx index cd4e0c6..83ce9f1 100644 --- a/arabluatex.dtx +++ b/arabluatex.dtx @@ -217,7 +217,7 @@ % % \fi % -% \CheckSum{697} +% \CheckSum{0} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -3297,6 +3297,13 @@ wa-ya.sIru ta.hta 'l-jild-i \DeclareDocumentCommand{\cap}{m}% {\luadirect{tex.sprint(cap(\luastringN{#1}))}} % \end{macrocode} +% \begin{macro}{\Cap} \changes{v1.8.2}{2017/04/02}{New \cs{Cap} macro: +% does the same as \cs{cap}, but not to be used outside \texttt{trans} +% mode.} +% \begin{macrocode} +\let\Cap\cap +% \end{macrocode} +% \end{macro} % \end{macro} % \begin{macro}{\txarb} \cs{txarb} sets the direction to right-to-left % and selects the Arabic font. It is used internally by several Lua diff --git a/arabluatex.lua b/arabluatex.lua index c71fe10..8644588 100644 --- a/arabluatex.lua +++ b/arabluatex.lua @@ -157,6 +157,11 @@ local function takeoutabjad(str) end local function takeoutcapetc(str) + str = string.gsub(str, "(\\arb.?%[trans%])(%b{})", function(tag, body) + body = string.sub(body, 2, -2) + body = string.gsub(body, "(\\cap%s?)(%b{})", "\\Cap%2") + return string.format("%s{%s}", tag, body) + end) str = string.gsub(str, "(\\cap.?)(%b{})", function(tag, body) body = string.sub(body, 2, -2) return string.format("%s", body) diff --git a/makefile b/makefile index 72f9c8f..4f1dac1 100644 --- a/makefile +++ b/makefile @@ -45,7 +45,7 @@ package: clean all clean: rm -rf ~/texmf/tex/lualatex/arabluatex/ rm -rf ~/.emacs.d/auctex/auto/arabluatex*.el - rm -rf tex/ doc/ source/ + rm -rf tex/ doc/ source/ auto/ rm -rf arabluatex/ rm -rf saved/ mkdir saved -- cgit v1.2.3