For my listings, I use this caption setup:
\usepackage{caption}
\DeclareCaptionFont{white}{\color{white}}
\DeclareCaptionFormat{listing}{\colorbox{gray}{\parbox{\textwidth}{#1#2#3}}}
\captionsetup[lstlisting]{format=listing,labelfont=white,textfont=white, margin=0pt, font={bf,footnotesize}}
For each listing, pdflatex warns me:
Overfull \hbox (6.0pt too wide) in paragraph at lines 129--129
In the PDF, one can easily see that it is indeed too wide there:

And a close up:

How can I get this to match exactly the width of the remaining contents?
captionpackage the optionbox=colorboxis available to make things easier. See http://tex.stackexchange.com/a/88206/2574 – May 16 '13 at 07:24