我使用 tcolorbox 来定义一个新环境,正如 Gonzalo 所建议的那样创建一个彩色盒子?。在那个环境下,我把图形放在框架内,如下图所示。我想调整表格框架和图形之间的空间。在我的例子中,我希望两侧都没有空间:左侧和右侧;顶部和底部也没有空间。你能告诉我如何调整吗?
代码是:
\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}
谢谢!
答案1
您必须将 的键设置为colorbox
:left
,right
,top
, ,bottom
并将0pt
插入图像的宽度设置为\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}
答案2
我得到的答案是:
\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,
}
将 {#1} 放在标题参数中。