-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Colorizing #5
Comments
I think this is doable with lualatex rather then xelatex with |
I am working in LuaLaTeX. Can you please supply a concrete example? |
\documentclass{article}
\usepackage{fontspec}
\usepackage{luacode,luacolor}
\setmainfont[Script=Arabic,Scale=3.5]{Amiri}
\newcommand\colr[2]{%
\protect\leavevmode
\begingroup
\color{#1}%
#2%
\endgroup
}
\begin{luacode}
function colored ( s )
s = unicode.utf8.gsub(s, "[ًٌٍَُِْ]","\\colr{red}{%1}")
return s
end
\end{luacode}
\def\FormatOn{%
\directlua{luatexbase.add_to_callback("process_input_buffer", colored, "colored")}}
\def\FormatOff{%
\directlua{luatexbase.remove_from_callback("process_input_buffer","colored")}}
\pagestyle{empty}
\begin{document}
\centering
\pardir TRT \textdir TRT
\FormatOn
تَجرِيبْ بسمِ اللهِ الرحمَانِ الرَحِيمْ
\FormatOff
\begin{luacode}
function colored ( s )
s = unicode.utf8.gsub(s, "[بم]","\\colr{blue}{%1}")
return s
end
\end{luacode}
\FormatOn
تَجرِيبْ بسمِ اللهِ الرحمَانِ الرَحِيمْ
\FormatOff
تَجرِيبْ بسمِ اللهِ الرحمَانِ الرَحِيمْ
\end{document} |
Actually, I don't know any obvious way to colorize symbols (haraka or letter) in xelatex, but as @seloumi mentioned you can simply use There is a nice way to colorize the haraka with the aid of \documentclass{article}
\usepackage{quran}
\usepackage{fontspec}
\setmainfont{Amiri Quran Colored}[RawFeature=colr,Script=Arabic]
\begin{document}
\pardir TRT \textdir TRT
\quransurah
\end{document} If you want to colorize a word or part of an ayah, I strongly suggest you to use \documentclass{article}
\usepackage{xcolor}
\usepackage[wordwise]{quran}
\usepackage{fontspec}
\setmainfont{Amiri}[Script=Arabic]
\begin{document}
\pardir TRT \textdir TRT
\quranayah[2][286][1-30]
{\color{red} \quranayah[2][286][31-38]}
\quranayah[2][286][39-49]
\end{document} |
Is it possible to colorize parts of an ayah (a word (words), a letter (letters), or perhaps haraka). I often need to highlight a certain word, etc., and that would be highly useful feature.
The text was updated successfully, but these errors were encountered: