[XeTeX] polyglossia and caption problem

Qt Developer suda.nix at hotmail.com
Sat May 8 18:50:11 CEST 2010


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/xetex/attachments/20100508/72d1e913/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: good-cap.PNG
Type: image/png
Size: 5988 bytes
Desc: not available
URL: <http://tug.org/pipermail/xetex/attachments/20100508/72d1e913/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bad-cap.PNG
Type: image/png
Size: 6155 bytes
Desc: not available
URL: <http://tug.org/pipermail/xetex/attachments/20100508/72d1e913/attachment-0003.png>


More information about the XeTeX mailing list