1

I get a non-fatal error when I run the following MWE:

%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode

\documentclass[12pt]{article}
\usepackage{geometry}
\geometry{letterpaper}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{xltxtra,fontspec,xunicode}

% Choose roman font (choosing the mapping so that ``-->“, '-->’ etc.).
\setromanfont[Mapping=tex-text]{Gentium}
\setmonofont[Scale=0.90,Ligatures=NoCommon]{Courier}

% Greek (not strictly necessary since I just use Gentium for both Greek and Latin).
\newfontfamily\greekfont{Gentium} % GFS Porson

% Arabic
\usepackage[novoc,fdf2alif]{arabxetex}
\newfontfamily\arabicfont[Script=Arabic,Scale=1.2,WordSpace=2]{USAMA NASKH}
\usepackage{bidi}
\usepackage{bidipoem}
\renewcommand\poemcolsepskip{1cm}
\newcommand{\ar}[1]{\textarab{#1}}

\usepackage[american]{babel} 
\usepackage{csquotes}


\begin{document}

\title{Title}
\author{Author}
\date{date}
\maketitle

text

\end{document}

The error message appears twice:

 /usr/local/texlive/2017/texmf-dist/tex/xelatex/bidi/latex-xetex-bidi.def:122: L
 aTeX Error: Command \XeTeX already defined.
                Or name \end... illegal, see p.192 of the manual.

Apparently there is some issue related to bidi or arabxetex, because when I comment out those lines, the error messages go away.

Question: is there away to solve the problem without removing Arabic script functionality?

  • 1
    Remove fontspec and bidi. arabxetex loads them anyway. Probably also remove xltxtra as you almost certainly don't need it. Shouldn't you be using language definitions for Arabic, as well as American? Or does xarabxetex take care of that? – cfr Jun 11 '17 at 23:48
  • 1
    fdf2alif is now deprecated. – cfr Jun 11 '17 at 23:49
2

@cfr's comments on my question deserve to be upgraded to the answer, which I give here:

The solution, as @cfr suggested, was to stop loading fontspec and bidi independently of arabxetex and removing xltxtra. That meant that I also had to load arabxetex before I started defining the Greek and Roman font families (since the latter require fontspec).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.