1

in this MWE

\documentclass[a4paper]{article}
\usepackage{listings}
\usepackage{tcolorbox}
\tcbuselibrary{listings}
\usepackage[no-math]{fontspec}
\usepackage{polyglossia}
\newfontfamily\arabicfont[Script=Arabic,Scale=1.3]{Amiri}
\setdefaultlanguage{english}
\setotherlanguage{arabic}
\lstset{language=[LaTeX]TeX,
,escapeinside={*}{*}}
\begin{document}

\begin{lstlisting}
\LaTeX * \textarabic{كلمة عربية}*
\end{lstlisting}

\begin{tcblisting}{listing only,listing options={style=tcblatex,escapeinside={*}{*}}}

\LaTeX  * %\textarabic{كلمة عربية}*
\end{tcblisting}

\end{document}

with lstlisting environment i can show arabic text using listing option escapeinside, But in contrast, with tcblisting if i remove % sign before \textarabic I get an error alert

! Package polyglossia Error: The current roman font does not contain the Arabic

any idea to fix this ?

4
  • Off-topic, but I’m just wondering, why is the 1.3 scale is applied to Amiri? Commented Aug 6, 2014 at 2:59
  • I cannot test your MWE since I don't have the Amiri font. I can just guess that font settings made by style=tcblatex could be the problem. So, please, try if listing options={language=[LaTeX]TeX,escapeinside={*}{*}} solve the problem. Commented Aug 6, 2014 at 6:16
  • My MWE work fine with listing option={langage= TeX,escapeinside={*}{*}} ([LaTeX]TeX cause error ...!Package Listings Error: File 'T(.tex)' not found), thanks for @ThomasF.Sturm and @KhaledHosny
    – Salim Bou
    Commented Aug 6, 2014 at 7:45
  • we can use listing option={language={[LaTeX]TeX},escapeinside={*}{*}}
    – Salim Bou
    Commented Aug 6, 2014 at 8:52

1 Answer 1

1

with this MWE you can show arabic script in tcblisting

\documentclass[a4paper]{article}
\usepackage{listings}
\usepackage{tcolorbox}
\tcbuselibrary{listings}
\usepackage[no-math]{fontspec}
\usepackage{polyglossia}
\newfontfamily\arabicfont[Script=Arabic]{Amiri}
\setdefaultlanguage{english}
\setotherlanguage{arabic}
\lstset{language=[LaTeX]TeX,escapeinside={*}{*}}
\begin{document}

\begin{lstlisting}
\LaTeX * \textarabic{كلمة عربية}*
\end{lstlisting}

\begin{tcblisting}{listing only,listing options={language={[LaTeX]TeX},escapeinside={*}{*}}}

\LaTeX  * \textarabic{كلمة عربية}*
\end{tcblisting}

\end{document}

and the result enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .