Create an adapted color macro for RTL mode (pdflatex and xelatex)












2















This is a complement to these questions:




  • Colors bizarre results with right to left text

  • Change color method used with beamer


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










share|improve this question

















This question has an open bounty worth +200
reputation from Salim Bou ending tomorrow.


Looking for an answer drawing from credible and/or official sources.












  • 1





    Why is switching to luatex not an option for you? You are now fighting since weeks with the insufficient rtf model of xelatex.

    – Ulrike Fischer
    Feb 4 at 11:04











  • Most of rtl writers use xelatex rather then lualatex because of the great support from bidi package

    – Salim Bou
    Feb 4 at 11:24











  • That's now. But seeing the lack of development in xetex/bidi/polyglossia compared to the changes in bidi/babel and the luatex engine I would say it would make more sense to spent your time to improve luatex.

    – Ulrike Fischer
    Feb 4 at 14:26
















2















This is a complement to these questions:




  • Colors bizarre results with right to left text

  • Change color method used with beamer


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










share|improve this question

















This question has an open bounty worth +200
reputation from Salim Bou ending tomorrow.


Looking for an answer drawing from credible and/or official sources.












  • 1





    Why is switching to luatex not an option for you? You are now fighting since weeks with the insufficient rtf model of xelatex.

    – Ulrike Fischer
    Feb 4 at 11:04











  • Most of rtl writers use xelatex rather then lualatex because of the great support from bidi package

    – Salim Bou
    Feb 4 at 11:24











  • That's now. But seeing the lack of development in xetex/bidi/polyglossia compared to the changes in bidi/babel and the luatex engine I would say it would make more sense to spent your time to improve luatex.

    – Ulrike Fischer
    Feb 4 at 14:26














2












2








2








This is a complement to these questions:




  • Colors bizarre results with right to left text

  • Change color method used with beamer


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










share|improve this question
















This is a complement to these questions:




  • Colors bizarre results with right to left text

  • Change color method used with beamer


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







macros color right-to-left






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 6 at 19:32







Salim Bou

















asked Feb 4 at 10:56









Salim BouSalim Bou

11.4k11442




11.4k11442






This question has an open bounty worth +200
reputation from Salim Bou ending tomorrow.


Looking for an answer drawing from credible and/or official sources.








This question has an open bounty worth +200
reputation from Salim Bou ending tomorrow.


Looking for an answer drawing from credible and/or official sources.










  • 1





    Why is switching to luatex not an option for you? You are now fighting since weeks with the insufficient rtf model of xelatex.

    – Ulrike Fischer
    Feb 4 at 11:04











  • Most of rtl writers use xelatex rather then lualatex because of the great support from bidi package

    – Salim Bou
    Feb 4 at 11:24











  • That's now. But seeing the lack of development in xetex/bidi/polyglossia compared to the changes in bidi/babel and the luatex engine I would say it would make more sense to spent your time to improve luatex.

    – Ulrike Fischer
    Feb 4 at 14:26














  • 1





    Why is switching to luatex not an option for you? You are now fighting since weeks with the insufficient rtf model of xelatex.

    – Ulrike Fischer
    Feb 4 at 11:04











  • Most of rtl writers use xelatex rather then lualatex because of the great support from bidi package

    – Salim Bou
    Feb 4 at 11:24











  • That's now. But seeing the lack of development in xetex/bidi/polyglossia compared to the changes in bidi/babel and the luatex engine I would say it would make more sense to spent your time to improve luatex.

    – Ulrike Fischer
    Feb 4 at 14:26








1




1





Why is switching to luatex not an option for you? You are now fighting since weeks with the insufficient rtf model of xelatex.

– Ulrike Fischer
Feb 4 at 11:04





Why is switching to luatex not an option for you? You are now fighting since weeks with the insufficient rtf model of xelatex.

– Ulrike Fischer
Feb 4 at 11:04













Most of rtl writers use xelatex rather then lualatex because of the great support from bidi package

– Salim Bou
Feb 4 at 11:24





Most of rtl writers use xelatex rather then lualatex because of the great support from bidi package

– Salim Bou
Feb 4 at 11:24













That's now. But seeing the lack of development in xetex/bidi/polyglossia compared to the changes in bidi/babel and the luatex engine I would say it would make more sense to spent your time to improve luatex.

– Ulrike Fischer
Feb 4 at 14:26





That's now. But seeing the lack of development in xetex/bidi/polyglossia compared to the changes in bidi/babel and the luatex engine I would say it would make more sense to spent your time to improve luatex.

– Ulrike Fischer
Feb 4 at 14:26










0






active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f473304%2fcreate-an-adapted-color-macro-for-rtl-mode-pdflatex-and-xelatex%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f473304%2fcreate-an-adapted-color-macro-for-rtl-mode-pdflatex-and-xelatex%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to change which sound is reproduced for terminal bell?

Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

Can I use Tabulator js library in my java Spring + Thymeleaf project?