<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
Hello,<br><br>I have a problem in making a custom caption to use with listings (to highlight source code) , i use polyglossia package and my default language is Arabic.<br>The code for custom caption is work good when i make the default language English.<br><br>This code work well:<br>-------------------------------<br><code>\documentclass[a4paper,oneside,headsepline,10pt]{scrbook}<br>\usepackage{color}<br>\usepackage{xcolor}<br>\usepackage{listings}<br><br>\usepackage{caption}<br>\DeclareCaptionFont{white}{\color{white}}<br>\DeclareCaptionFormat{listing}{\colorbox{gray}{\parbox{\textwidth}{#1#2#3}}}<br>\captionsetup[lstlisting]{format=listing,labelfont=white,textfont=white}<br><br>% This concludes the preamble<br>\begin{document}<br><br>\begin{lstlisting}[label=some-code,caption=Some Code]<br>public void here() {<br>&nbsp; &nbsp; &nbsp; &nbsp; goes().the().code()<br>}<br>\end{lstlisting}<br>\end{document}<br></code>-------------------------------<br><br><br>but when i make t
 he default language arabic it doesn't work,and the gray box is not appear !<br><br>here is my code:<br>-------------------------------<br>\documentclass[a4paper,oneside,headsepline,10pt]{scrbook}<code><br></code>\usepackage{color}<code><br></code>\usepackage{xcolor}<code><br></code>\usepackage{fontspec}<code><br></code>\usepackage{listings}<code><br></code>\usepackage{caption}<code><br></code>\DeclareCaptionFont{white}{\color{white}}<code><br></code>\DeclareCaptionFormat{listing}{\colorbox{gray}{\parbox{\textwidth}{#1#2#3}}}<code><br></code>\captionsetup[lstlisting]{format=listing,labelfont=white,textfont=white}<code><br><br></code>\providecommand{\newXeTeXintercharclass}[1]{\edef #1\relax}<code><br></code>\usepackage{polyglossia}<code><br></code>\setmainlanguage{arabic}<code><br></code>\setotherlanguage{english}<code><br><br></code>\setmainfont[Script=Arabic,Scale=1.5,Mapping=arabicdigits]{Traditional Arabic}<code><br><br></code>\begin{document}<code><br><br></code>% Arabic
  sentence will be here..<code><br><br></code>\begin{english}<code><br></code>\fontspec{Courier New}<code><br></code>\begin{lstlisting}[label=some-code,caption=Some Code]<code><br></code>public void here() {<code><br></code>&nbsp; &nbsp; &nbsp; &nbsp; goes().the().code()<code><br></code>}<code><br></code>\end{lstlisting}<code><br></code>\end{english}<code><br><br>\end{document}<br></code>-------------------------------<br><dl class="codebox"><dt>I attached pictures for the first and second tex code.</dt></dl>Thanks in advance.<br><br>                                               <br /><hr />Hotmail: Powerful Free email with security by Microsoft. <a href='https://signup.live.com/signup.aspx?id=60969' target='_new'>Get it now.</a></body>
</html>