[XeTeX] Arabic text and color
Vafa Khalighi
vafa at users.berlios.de
Thu Aug 20 01:22:16 CEST 2009
If I was in your place, I would just load xecolour package and usecolour
without any issue in bidirectional texts so in your example this is how you
could use it:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass{article}
\usepackage{xecolour}
\usepackage{fontspec}
\usepackage[fullvoc,fdf2noalif]{arabxetex}
\newfontinstance\arabicfont[Script=Arabic,Scale=1.2,WordSpace=2]{XB Zar}
\begin{document}
\LARGE
\begin{arab}
اعْلَمْ بِأَنَّ
\green{الرّاست}
أَصْلٌ مُسْتَقِلْ
\end{arab}
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
so it gives you the result you want and it supports colour spanning multiple
lines.
However you still can use color or xcolor package but it will not support
colour spanning multiple lines in RTL mode, so if you decide to go this way
put this code at the preamble of your document after loading bidi package
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\newcommand{\green}[1]{\beginL{\color{green}\if at RTL\beginR\fi#1\if at RTL
\endR\fi}\endL}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/xetex/attachments/20090820/4c01c382/attachment.html>
More information about the XeTeX
mailing list