#StackBounty: #macros #color #right-to-left Create an adapted color macro for RTL mode (pdflatex and xelatex)

Bounty: 200

This is a complement to these questions:

My aim is to create a macro like color which can be used in RTL mode (right to left) and in all circumstances to color text and drawing stuff without issues:

Here my attempt (which use fontspec Color key to color text and normal color to color rules and drawings but this need external markup ~ ~)

documentclass{article}
usepackage{xcolor}
usepackage{fontspec}
setmainfont{Amiri}

usepackage[rldocument]{bidi}

defrtlcolor#1{%
def~{bgroupcolor{#1}let~egroup}
addfontfeature{Color=#1}
}

begin{document}

Right to left text {rtlcolor{red} RED TEXT ~rule{5pt}{5pt}~ right to left text  
right to left text right to left text right to left text right to left text } out of group 

end{document}

enter image description here


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.