Transliteration problem with arabxetex package

The following code is not producing properly formatted transliteration of the Arabic text. I have no trouble producing proper Arabic characters with the [voc] option, but the [trans] option is not functioning:

\documentclass[]{article}
\def\latexmode{memoir}
\usepackage{arabxetex}
\begin{document}
\begin{arab}[trans] fI qulUbi-him wa-jawAri.hi-him
\end{arab}
inline:  (\textarab[trans]{fI qulUbi-him wa-jawAri.hi-him})
\end{document}


Output:

fI qulUbi-him wa-jawAri.hi-him

inline: (fI qulUbi-him wa-jawAri.hi-him)

Should be something like:

fī qulūbi-him wa-jawāriḥi-him

• Welcome to the TeX.SX! Could you please make it a full minimal (working) example starting with \documentclass... and ending with \end{document}? It would help the solvers a lot. – Malipivo Apr 9 '14 at 17:43
• I would highly recommend to type Arabic characters and their transliteration directly with unicode (كتاب and kitāb) and to avoid using that package which -- IMHO -- now became somewhat obsolete. – ClintEastwood Apr 10 '14 at 5:25
• Yes, but then I can't switch between transliterated text and arabic script. If I use unicode, this is what I get with (\textarab[voc]{fī qulūbi-him wa-jawāriḥi-him}): ( رِحِهِم بِهِم وَجَو قُل ف). With (\textarab[voc]{fI qulUbi-him wa-jawAri.hi-him}) I get: ( فِي قُلُوبِهِم وَجَوَارِحِهِم ) I want to be able to switch between standard transliteration and arabic characters depending on the situation. – JohnW Apr 10 '14 at 15:37
• Are there any news here? – TeXnician Aug 9 '18 at 7:42

The correct answer is: set a default font for the document using a fontspec command, such as \setmainfont{Noto Serif}. The addfontfeature works through fontspec. arabxetex loads fontspec in the background. So this is sufficient:

\documentclass[12pt]{article}
\usepackage{arabxetex}
\setmainfont{Noto Serif}
\newfontfamily\arabicfont[Script=Arabic, Scale=1.5]{Amiri}
\begin{document}
\begin{arab}[trans] fI qulUbi-him wa-jawAri.hi-him
\end{arab}
\textLR{inline:  (}\textarab[trans]{fI qulUbi-him wa-jawAri.hi-him}\textLR{)}
\end{document}


If no mainfont is specified, the default is lmr, which can't handle the mapping. The font feature request is sent, according to the log, but nothing can be done with it.

The hack described in the original posting below is not needed.

Original post:

Firstly, you need to use a font that contains the transliteration characters (see 3.3 of the documentation) - they are in the Latin Extended-A unicode block: Amiri has them, Scheherazade does not. Amiri is recommended in the instructions.

Secondly, you need to activate the mapping file, either arabtex-trans-loc or arabtex-trans-dmg, with the \addfontfeature command for the font:

\arabicfont\addfontfeature{Mapping=arabtex-trans-loc}


The documentation explains the difference between the two transliteration styles.

MWE

\documentclass[12pt]{article}
\usepackage{arabxetex}
\newfontfamily\arabicfont[Script=Arabic, Scale=1.5]{\myfont}

\begin{document}
Using \myfont .

\begin{arab}[trans] fI qulUbi-him wa-jawAri.hi-him
\end{arab}
\textLR{inline:  (}\textarab[trans]{fI qulUbi-him wa-jawAri.hi-him}\textLR{)}

\begin{arab}[novoc] fI qulUbi-him wa-jawAri.hi-him
\end{arab}

\begin{arab}[voc]mi'aT , mi'at"An , sabami'"aT\end{arab}

\begin{arab}[trans]mi'aT , mi'at"An , sabami'"aT\end{arab}

\begin{arab}[trans]al-^say_h al-Alim \UC na.sIr \UC al-dIn \UC al-.tUsI\end{arab}

\begin{arab}[novoc]al-^say_h al-Alim \UC na.sIr \UC al-dIn \UC al-.tUsI\end{arab}

\end{document}


Be careful of the text left-to-right in the inline.

Note that Scheherazade is missing most of the letters with diacritics.