I work with ArabLuatex on the edition of a scholarly Arabic text.

In my Arabic text I want to differentiate between fully vocalized fragments in text blocks that are sparingly vocalized. I wish to mark these fragments with another color.

When I put the instructions, starting with \RL, directly in the text, the fragment is correctly colored and vocalized.

Yet when I put the code in a macro, the fragment is colored, but the voc or fullvoc instruction does not work.

Has anybody a solution?

A minimal example (to be processed with lualatex) follows underneath.

\newfontfamily\arabicfont[Script=Arabic, Scale=1.35]{Scheherazade}
\setmainfont[Numbers=OldStyle]{Gentium Book Basic}

%\newcommand*{\trk}[1]{\LR{\textcolor{red}{1 #1} \arb[fullvoc]{2 #1}}}


'a_hAfu mina 'l-malik-i 'lla_dI ya.zlimu 'l-nAs-a 

\RL{\textcolor{green}{\arb[fullvoc]{'a_hAfu mina 'l-malik-i 'lla_dI ya.zlimu 'l-nAs-a}}}

\trk{'a_hAfu mina 'l-malik-i 'lla_dI ya.zlimu 'l-nAs-a}


Well, this is not related to TeX expansion mechanism, nor it is to the color commands. Actually arabluatex expects any single-argument command to have Arabic text in its argument: see the general principle that is laid in sect. 10 on p. 37 of the documentation for more information.

For example, if you try to create this simple command: \newcommand{\fvarabic}[1]{\arb[fullvoc]{#1}}, then use it inside a, say, novoc environment, it will always produce non-vocalized Arabic because its argument will have been processed by the novoc rules before \fvarabic can see it.

I would argue this is more a feature than an actual bug ;)

For the time being, as a workaround, you may prefix any new command that you would like to create by \RL for it to be accepted by arabluatex as one that does not have only running Arabic text in its argument, like so:


This will work.

The next release of arabluatex (to be published in a couple of days) will allow to "declare" such new commands so that arabluatex will handle them just as \RL, \LR and the like.

EDIT arabluatex 1.9 is out and should be available on the mirrors of CTAN in a couple of days. A new command \MkArbBreak which allows to ˘declare° new commands to be inserted in Arabic environments has been added (see 10.1 p. 39 in the documentation of v1.9).


Unfortunately Ulrike's response does not work. The vocalisation does not show in the red text.

I found the following solution:


function trk_help ( s )
 s = string.gsub ( s , "\\trk%b{}"   ,   "\\RL{%0}" )
 return s
luatexbase.add_to_callback ( "process_input_buffer", trk_help , "trk_help" )

Yet I do not why it works.

  • 1
    You are right,my solution it doesn't work. I looked only at the begin and not at the rest of the text. The arab environment looks (with lua) for the string \arb and handles this in a special way. So it looks as if the only "pure latex" solution would be to redefine/patch \arb to add colors. Jun 23 '17 at 14:28
  • 1
    Quite right. Actual support for colors has not been added yet in arabluatex, hence the \LR advice. I'll add some basic support in a couple of days. Jun 24 '17 at 6:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.