# listings package conflict with polyglossia [closed]

I cut down the minimum working example; I am using XeTeX. The following code does not work unless I comment the line \setotherlanguage{arabic} or the line \usepackage{listings}. When I compile the following example it opens the file xelatex/bidi/listings-xetex-bidi.def and points at:

\ProvidesFile{listings-xetex-bidi.def}[2017/01/14 v1.4 bidi adaptations for listings package for XeTeX engine]
\lst@Key{captiondirection}{textdirection}{%
\lstKV@SwitchCases{#1}%
{textdirection&\\%
RTL&\chardef\bidi@lst@caption@direction\@ne\\%
LTR&\chardef\bidi@lst@caption@direction\z@%
}{\PackageError{Listings}{direction #1 unknown}\@ehc}}


and gives me the error message:

! Package Listings Error: direction textdirection unkown.


The code:

\documentclass[11pt, b6paper, landscape, oneside]{memoir}

\usepackage{listings}
\usepackage{fontspec}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage{arabic}

\begin{document}

Hello

\end{document}


## closed as off-topic by Andrew Swann, Phelype Oleinik, Romain Picot, Mensch, CircumscribeNov 30 '18 at 12:55

• This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

• Your example compiles for me. What error do you get? – Ulrike Fischer Oct 16 '18 at 6:45
• With XeLaTeX the MWE compiles fine for me. With LuaLaTeX I get complaints about \luatexpardir. What error do you get? Can you show us the .log file? – moewe Oct 16 '18 at 9:03
• Thanks so much for your fast reply; I updated the post to contain the error message and more details – Waleed A. Yousef Oct 16 '18 at 9:08
• @Waleed A. Yousef This problem has solved in bidi-33.2. please see tex.stackexchange.com/questions/450824/… and update the bidi package. – SH.Madadpour Nov 2 '18 at 6:48
• I'm voting to close this question as off-topic because it was a bug solved by an update to the bidi package – Andrew Swann Nov 30 '18 at 11:44