# spacing between text and frame of table?

I use tcolorbox to define a new environment as suggested by Gonzalo at Create a color box?. In that environment, I put the figure inside the frame as the code shown below. I want to adjust the space beetween the frame of table and the figure. In my case I want no space both sides: left and right; and no space for top and bottom. Can you tell me how to adjust it?

code is:

\documentclass[12pt]{book}
\usepackage{lettrine}
\usepackage[explicit]{titlesec}
\usepackage{xcolor}
\usepackage[many]{tcolorbox}
\usetikzlibrary{calc}
\usepackage[utf8]{vietnam}
\usepackage{fancyhdr}
\usepackage[explicit]{titlesec}
\usepackage[unicode]{hyperref}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{tcolorbox}

\newtcolorbox[auto counter, number within = chapter]{bang}[1][]{
colframe = myblue,
colback  = white,
coltitle = white,
outer arc=0pt,
arc=0pt,
title    = {\bf Bảng ~\thetcbcounter} ,
#1,
}
\begin{document}
\begin{bang}
\includegraphics[scale=.78]{image/Chapter10/table10-1.png}
\end{bang}
\end{document}


Thanks!

You must set keys of colorbox: left, right, top, bottom to 0pt, and width of the inserted image to \linewidth

\documentclass[12pt]{book}
\usepackage{lettrine}
\usepackage[explicit]{titlesec}
\usepackage{xcolor}
\usepackage[many]{tcolorbox}
\usetikzlibrary{calc}
\usepackage[utf8]{vietnam}
\usepackage{fancyhdr}
\usepackage[explicit]{titlesec}
\usepackage[unicode]{hyperref}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{tcolorbox}

\definecolor{myblue}{RGB}{0,163,243}

\newtcolorbox[auto counter, number within = chapter]{bang}[1][]{
colframe = myblue,
colback  = white,
coltitle = white,
outer arc=0pt,
arc=0pt,
left=0pt,
right=0pt,
top=0pt,
bottom=0pt,
title    = {\bf Bảng ~\thetcbcounter} ,
#1,
}
\begin{document}
\begin{bang}
\includegraphics[width=\linewidth]{example-image-a}%{image/Chapter10/table10-1.png}
\end{bang}
\end{document}

• Hi Salim, I did follow your instruction, however, there is still a little bit space surrounding the figure (image). Does it need to set space = 0 surrounding for the image? If yes, how can I do it? Thanks (here is the link to photo : imgur.com/PsBROfb ) Jul 28 '15 at 14:04
• Try to add boxsep=0pt to tcolorbox keys Jul 28 '15 at 14:10
• Hi Salim, one more thing if you can assist me. I would like to put the caption of "Partial Listing of Data on U.S.Inflation and Unemployment Rates, 1948-2003" after the "Bảng 10.1" for instance. how can I create an environment of "bang" with the title or caption so that apply for the whole document? Jul 28 '15 at 14:54

I got the answer is:

\newtcolorbox[auto counter, number within = chapter]{bang}[1][]{
colframe = myblue,
colback  = white,
coltitle = white,
outer arc=0pt,
arc=0pt,
left=0pt,
right=0pt,
top=0pt,
bottom=0pt,
title    = {\bf Bảng ~\thetcbcounter \hspace{0.4cm} {#1}} ,
#1,
}


put the {#1} in the title argument.