Hello,

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.
The code for custom caption is work good when i make the default language 
English.

This code work well:
-------------------------------
\documentclass[a4paper,oneside,headsepline,10pt]{scrbook}
\usepackage{color}
\usepackage{xcolor}
\usepackage{listings}

\usepackage{caption}
\DeclareCaptionFont{white}{\color{white}}
\DeclareCaptionFormat{listing}{\colorbox{gray}{\parbox{\textwidth}{#1#2#3}}}
\captionsetup[lstlisting]{format=listing,labelfont=white,textfont=white}

% This concludes the preamble
\begin{document}

\begin{lstlisting}[label=some-code,caption=Some Code]
public void here() {
        goes().the().code()
}
\end{lstlisting}
\end{document}
-------------------------------


but when i make the default language arabic it doesn't work,and the gray box is 
not appear !

here is my code:
-------------------------------
\documentclass[a4paper,oneside,headsepline,10pt]{scrbook}
\usepackage{color}
\usepackage{xcolor}
\usepackage{fontspec}
\usepackage{listings}
\usepackage{caption}
\DeclareCaptionFont{white}{\color{white}}
\DeclareCaptionFormat{listing}{\colorbox{gray}{\parbox{\textwidth}{#1#2#3}}}
\captionsetup[lstlisting]{format=listing,labelfont=white,textfont=white}

\providecommand{\newXeTeXintercharclass}[1]{\edef #1\relax}
\usepackage{polyglossia}
\setmainlanguage{arabic}
\setotherlanguage{english}

\setmainfont[Script=Arabic,Scale=1.5,Mapping=arabicdigits]{Traditional Arabic}

\begin{document}

% Arabic sentence will be here..

\begin{english}
\fontspec{Courier New}
\begin{lstlisting}[label=some-code,caption=Some Code]
public void here() {
        goes().the().code()
}
\end{lstlisting}
\end{english}

\end{document}
-------------------------------
I attached pictures for the first and second tex code.Thanks in advance.

                                          
_________________________________________________________________
Hotmail: Powerful Free email with security by Microsoft.
https://signup.live.com/signup.aspx?id=60969

<<attachment: good-cap.PNG>>

<<attachment: bad-cap.PNG>>


--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
  http://tug.org/mailman/listinfo/xetex

Reply via email to