\usepackage{listings} \usepackage{color} \definecolor{gray}{rgb}{0.4,0.4,0.4} \definecolor{darkblue}{rgb}{0.0,0.0,0.6} \definecolor{cyan}{rgb}{0.0,0.6,0.6} \lstset{ basicstyle=\footnotesize\ttfamily columns=fullflexible, showstringspaces=false, commentstyle=\color{gray}\upshape } \lstdefinelanguage{XML} { morestring=[b]", morestring=[s]{>}{<}, morecomment=[s]{}, stringstyle=\color{black}, identifierstyle=\color{darkblue}, keywordstyle=\color{cyan}, morekeywords={xmlns,version,type}% list your attributes here } \usepackage{caption} \usepackage{listings} \DeclareCaptionFont{white}{ \color{white} } \DeclareCaptionFormat{listing}{ \colorbox[cmyk]{0.43, 0.35, 0.35,0.01 }{ \parbox{\textwidth}{\hspace{15pt}#1#2#3} } } \captionsetup[lstlisting]{ format=listing, labelfont=white, textfont=white, singlelinecheck=false, margin=0pt, font={bf,footnotesize} }