aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arabluatex.dtx53
-rw-r--r--arabluatex.lua6
2 files changed, 38 insertions, 21 deletions
diff --git a/arabluatex.dtx b/arabluatex.dtx
index 4da2745..b323ada 100644
--- a/arabluatex.dtx
+++ b/arabluatex.dtx
@@ -227,7 +227,7 @@
227%</driver> 227%</driver>
228% \fi 228% \fi
229% 229%
230% \CheckSum{700} 230% \CheckSum{0}
231% 231%
232% \CharacterTable 232% \CharacterTable
233% {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 233% {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
@@ -2282,6 +2282,24 @@ word that \cs{arbnull} is applied to.
2282%</example> 2282%</example>
2283% \fi 2283% \fi
2284% 2284%
2285% \paragraph{Color}
2286% Here comes the example:
2287% For example, to distinguish words with a different color, one may
2288% proceed like so:---
2289% \iffalse
2290%<*example>
2291% \fi
2292\begin{arabluacode}
2293\begin{arab}
2294_tumma "intalaqa _dU 'l-qarn-ayni 'il_A 'ummaT-iN 'u_hr_A fI
2295\arbcolor{red}{\arb[fullvoc]{((ma.tli`-i 'l-^sams-i))}}
2296wa-lA binA'-a la-hum yu'amminu-hum mina 'l-^sams-i.
2297\end{arab}
2298\end{arabluacode}
2299% \iffalse
2300%</example>
2301% \fi
2302%
2285% \section{Transliteration} 2303% \section{Transliteration}
2286% \label{sec:transliteration} 2304% \label{sec:transliteration}
2287% It may be more appropriate to speak of \enquote{romanization} than 2305% It may be more appropriate to speak of \enquote{romanization} than
@@ -2794,23 +2812,7 @@ al-muqAtil-Ina.}, wa-kAnat 'ummI min `u.zamA'-i buyUt-i
2794% \DescribeMacro{\RL} \cs{RL}\marg{arg} does the same as 2812% \DescribeMacro{\RL} \cs{RL}\marg{arg} does the same as
2795% \cs{LR}\marg{arg}, but typesets its argument from right to left. Even 2813% \cs{LR}\marg{arg}, but typesets its argument from right to left. Even
2796% in an Arabic environment, this command may be useful. 2814% in an Arabic environment, this command may be useful.
2797% 2815%
2798% For example, to distinguish words with a different color, one may
2799% proceed like so:---
2800% \iffalse
2801%<*example>
2802% \fi
2803\begin{arabluacode}
2804\begin{arab}
2805_tumma "intalaqa _dU 'l-qarn-ayni 'il_A 'ummaT-iN 'u_hr_A fI
2806\LR{\textcolor{red}{\arb[fullvoc]{((ma.tli`-i 'l-^sams-i))}}}
2807wa-lA binA'-a la-hum yu'amminu-hum mina 'l-^sams-i.
2808\end{arab}
2809\end{arabluacode}
2810% \iffalse
2811%</example>
2812% \fi
2813%
2814% \DescribeMacro{\LRfootnote} \DescribeMacro{\RLfootnote} 2816% \DescribeMacro{\LRfootnote} \DescribeMacro{\RLfootnote}
2815% \cs{LRfootnote}\marg{text} and \cs{RLfootnote}\marg{text} typeset 2817% \cs{LRfootnote}\marg{text} and \cs{RLfootnote}\marg{text} typeset
2816% left-to-right and right-to-left footnotes respectively in Arabic 2818% left-to-right and right-to-left footnotes respectively in Arabic
@@ -3461,6 +3463,21 @@ wa-ya.sIru ta.hta 'l-jild-i
3461 \else \fi\fi\fi\fi}[\par] 3463 \else \fi\fi\fi\fi}[\par]
3462% \end{macrocode} 3464% \end{macrocode}
3463% \end{environment} 3465% \end{environment}
3466% \begin{macro}{\arbcolor}
3467% \changes{v1.8.6}{2017/06/25}{New \cs{arbcolor} command}
3468% \cs{arbcolor} is the equivalent for the \cs{textcolor} command. Just
3469% as the latter, it takes two mandatory arguments. Of course,
3470% \cs{textcolor} must be defined for \cs{arbcolor} to work.
3471% takes two mandatory arguments.
3472% \begin{macrocode}
3473\NewDocumentCommand{\arbcolor}{m m}{%
3474 \ifdefined\textcolor%
3475 \textcolor{#1}{#2}%
3476 \else\@gobble#1%
3477 \arb{#2}
3478 \fi}
3479% \end{macrocode}
3480% \end{macro}
3464% \begin{environment}{arabverse} 3481% \begin{environment}{arabverse}
3465% \changes{v1.6}{2016/12/17}{New environment \texttt{arabverse} for 3482% \changes{v1.6}{2016/12/17}{New environment \texttt{arabverse} for
3466% typesetting Arabic poetry} The |arabverse| environment may receive 3483% typesetting Arabic poetry} The |arabverse| environment may receive
diff --git a/arabluatex.lua b/arabluatex.lua
index ffdc7c7..c8011b1 100644
--- a/arabluatex.lua
+++ b/arabluatex.lua
@@ -73,12 +73,12 @@ local function breakcmd(str)
73 body = string.sub(body, 2, -2) 73 body = string.sub(body, 2, -2)
74 return string.format("}\\%s{%s}\\arb{", tag, body) 74 return string.format("}\\%s{%s}\\arb{", tag, body)
75 end) 75 end)
76 -- \textcolor 76 -- \arbcolor
77 str = string.gsub(str, "\\(textcolor.-)(%b{})(%b{})", 77 str = string.gsub(str, "\\(arbcolor.-)(%b{})(%b{})",
78 function(tag, bodycolor, bodytext) 78 function(tag, bodycolor, bodytext)
79 bodycolor = string.sub(bodycolor, 2, -2) 79 bodycolor = string.sub(bodycolor, 2, -2)
80 bodytext = string.sub(bodytext, 2, -2) 80 bodytext = string.sub(bodytext, 2, -2)
81 return string.format("}\\%s{%s}{\\arb{%s}}\\arb{", tag, bodycolor, bodytext) 81 return string.format("}\\textcolor{%s}{\\arb{%s}}\\arb{", bodycolor, bodytext)
82 end) 82 end)
83 -- Footnote 83 -- Footnote
84 str = string.gsub(str, "\\(Footnote.-)(%b{})", 84 str = string.gsub(str, "\\(Footnote.-)(%b{})",