# Using Arabic letters in moderncv package

I'm trying to include a small snippet or Arabic script into my document. This works fine if I use the documentclass article, but I'm using the moderncv package as provided here, and for some reason, it won't play nice with any of the Arabic packages for LaTeX (that I know of). Note: my MacTeX distribution also packages a moderncv package, but I think it's different: they give slightly different results. In fact, my document, as it is, doesn't compile with this version of moderncv.

Anyway, I'm failing to include my piece of Arabic script. I've tried the following things:

• \usepackage{polyglossia}. But it requires XeLaTeX, and my document doesn't seem to want to compile with XeLaTeX (only with pdfLaTeX). I think there are some other XeLaTeX based solutions as well.
• \usepackage{arabtex} When I try to compile this, I get the following error, which I don't know how to resolve:

! Undefined control sequence
<argument> \rm \it

l.551 \settransfont {\rm \it }
% standard font for transliteration

• \usepackage[LAE,T1]{fontenc}\usepackage[arabic]{babel} This gives me the following error: ! LaTeX Error: \tableofcontents undefined. This is actually easy enough to fix: \newcommand{\tableofcontents}{}. Rinse and repeat for a few other commands. Until, finally, I get this error message:

! Undefined control sequence.
\thetable ...\number \c@table .\number \c@chapter
}\protect \else \protect \...
l.24 \section{Arabic}


Again, I don't know how to resolve this.

• Finally, I try setting the font directly, like this:

\usepackage[LAE,T1]{fontenc}
...
{\usefont{LAE}{cmr}{m}{n}\selectfont العربية}


This does give me Arabic letters in my document, but they will end op left-to-right, and they will be the isolated forms of the letters, instead of joined letters.

I don't mind if the solution is ugly, I just want it to work. It's only a few words in an otherwise completely English document.

Here's a minimal document with the moderncv package that will reproduce the problem (on my machine, at least).

\documentclass[11pt,a4paper]{moderncv}
\usepackage[utf8]{inputenc}

\firstname{ABC}
\familyname{XYZ}
\title{curriculum vitae}

\begin{document}

\maketitle
\section{A section}

(...a few words in Arabic here...)

\end{document}


moderncv doesn't provide support for the old two-letter commands such as \rm, \it and arabtex needs those commands, so one option would be to declare them before loading arabtex, and then use \RL to transliterate the Arabic text; a little example (I have no idea what the Arabic text says; I just copied it from elsewhere):

\documentclass[11pt,a4paper]{moderncv}
\usepackage[utf8]{inputenc}
\moderncvstyle{casual}
\moderncvcolor{blue}
\makeatletter
\DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm}
\DeclareOldFontCommand{\sf}{\normalfont\sffamily}{\mathsf}
\DeclareOldFontCommand{\tt}{\normalfont\ttfamily}{\mathtt}
\DeclareOldFontCommand{\bf}{\normalfont\bfseries}{\mathbf}
\DeclareOldFontCommand{\it}{\normalfont\itshape}{\mathit}
\DeclareOldFontCommand{\sl}{\normalfont\slshape}{\@nomath\sl}
\DeclareOldFontCommand{\sc}{\normalfont\scshape}{\@nomath\sc}
\makeatother
\usepackage{arabtex}

\firstname{ABC}
\familyname{XYZ}
\title{curriculum vitae}

\begin{document}

\makecvtitle

\section{A section}
\RL{f.s.hY AltrA_t}

\end{document}


• I had to add \usepackage[english]{babel} to make it work with the version of moderncv I'm using, but it works now! Your Arabic text means something like 'classical heritage'. – jqno Aug 13 '13 at 7:39
• @jqno Glad to hear it worked. Thanks for the translation of the text. – Gonzalo Medina Aug 13 '13 at 22:57

You'd better use xelatex -- arabtex fonts are readable, but kind of amateurish.

\documentclass[11pt,a4paper]{moderncv}
\usepackage{fontspec}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage{arabic}
\setmainfont{Libre Bodoni}
\newfontfamily\arabicfont[Script=Arabic]{Amiri}

\moderncvstyle{casual}
\moderncvcolor{blue}

\firstname{ABC}
\familyname{XYZ}
\title{curriculum vitae}

\begin{document}

\makecvtitle

\section{A section}
\textarabic{اسمي سليم}

\end{document}


Yes, there are plenty of errors from microtype, but the document compiles in the end. I'd rather not play with moderncv internals, but it should be simple to remove those error messages.