# Coloring Arab suffix without losing connection

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}

\begin{document}

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

\textarab[voc]{kitabhA}

\end{document}
-

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}

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.

-

Using the built-in mechanism of ArabTeX, you can indicate by a hyphen (which becomes invisible) that a given letter should consider itself medial, albeit standing at a word border.

kitabu-\textcolor{red}{-hA}

should make do in your example. However the choice of the font may change the result significantly. (I don't know, if the two forms of the ha are acceptable for the context of the question.) See also my answer here.

-

To obtain colored vowels in Arabic script, we can use ArabTeX with the acolor.sty. The following example shows how to use it:

\documentclass[a4paper,12pt]{report}
\usepackage[utf8,latin1]{inputenc}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{graphicx}
\usepackage{arabtex}
\usepackage{acolor}
\usepackage{fancybox}
\usepackage{pgf,tikz}
\usepackage[left=1.5cm,right=1.5cm,top=2.5cm,bottom=2.5cm]{geometry}
\definecolor{lightyellow}{rgb}{1,1,.933777}
\definecolor{darkgreen}{rgb}{0.2,0.6,0.2}
\definecolor{poppyred}{rgb}{0.89,0.08,0.3}
\definecolor{poppyredd}{rgb}{0.78,0.0,0.09}
\definecolor{poppyreddd}{rgb}{0.63,0.0,0.0}
\pagestyle{empty}
\begin{document}

\def\ombre[#1][#2]#3{%
\begin{tikzpicture}
\node[text=#2,opacity=0.5] (ombre)
at (0,0) {#3};
\node[text=#1] at (-.089,.089) {#3};
\end{tikzpicture}
}

\setlength{\fboxrule}{3pt}
\setlength{\fboxsep}{4pt}

\begin{center}
\fcolorbox{blue!30!black}{lightyellow!47!white}{\ombre[blue!30!black][yellow]{\Huge \setnashbf \RL{\fullvocalize \acolor{diacritics}{poppyred} \acolor{letters}{darkgreen}     $\bigstar$ bismi  al-ll_ahi \acolor{diacritics}{poppyredd}  al-rra.h-m_ani \acolor{diacritics}{poppyreddd}  al-rra.hImi $\bigstar$}}}
\end{center}

\bigskip

\begin{center}
\fcolorbox{blue!30!black}{lightyellow!47!white}{\ombre[blue!30!black][yellow]{\LARGE \setnashbf \RL{ \fullvocalize \acolor{diacritics}{blue} \acolor{letters}{darkgreen}
$\ast$ wa bihi na-s-ta-Inu wa  al-.ha--mdu li-ll_ahi a-lla_dI yassaranA \acolor{hamza}{purple} lil-'a--mAli al-.s.sAli.haTi $\ast$ }}}

\end{center}
\end{document}
-
where to find acolor.sty ? – Hafid Boukhoulda Apr 15 at 21:22