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 ?

  • Off-topic, but I’m just wondering, why is the 1.3 scale is applied to Amiri? – Khaled Hosny Aug 6 '14 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. – Thomas F. Sturm Aug 6 '14 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 Aug 6 '14 at 7:45
  • we can use listing option={language={[LaTeX]TeX},escapeinside={*}{*}} – Salim Bou Aug 6 '14 at 8:52
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

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.