Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How can I change the color of Arab word endings without losing the connections? It's just ugly and loses readability. I'm using Tex Live 2012: arabxetex with xelatex but any package and/or engine is welcome.

\documentclass{article}

\usepackage{arabxetex}

\newcommand{\colorred}[1]{{\addfontfeature{Color=FF00FF}#1}}


\begin{document}

\textarab[voc]{kitab\colorred{hA}}

\textarab[voc]{kitabhA}

\end{document}
share|improve this question
add comment

1 Answer

up vote 9 down vote accepted

A workaround is to insert Zero Width Joiner character around the text break area, this would force final/initial forms. For most fonts with should be OK, though it would break contextual alternates in more advanced fonts, but the text should still be readable. Other than that, there is no way to switch color without breaking text into two parts in XeTeX.

\documentclass{article}

\usepackage{xcolor}
\usepackage{arabxetex}
\newfontfamily\arabicfont[Script=Arabic]{Amiri}

\newcommand{\colorred}[1]{\char"200D\textcolor{red}{\char"200D #1}}

\begin{document}

\textarab[voc]{kitab\colorred{hA}}

\textarab[voc]{kitabhA}

\end{document}

sample output

P.S. just use regular color package, \addfontfeature{} loads (and switches to) a new font each time it is called, witch is an overkill for just switching colors.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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