我制作了一个框,遇到了一些问题。第一个问题是,无论我如何更改顶部标题或底部标题,框与下方文章之间的间距仍然不变。
如何才能减小盒子和文章之间的间距?
\newtcolorbox[auto counter]{Problem}[1][]{%
enhanced,
breakable,
colback=white,
colbacktitle=white,
coltitle=black,
fonttitle=\bfseries,
boxrule=1.25pt,
titlerule=.2pt,
toptitle=1.5pt,
bottomtitle=1.5pt,
title=Problem~\thetcbcounter,
#1}
\renewcommand{\baselinestretch}{1.5}
答案1
如果你看一下tcolorbox
包装文档:
你会看到,框前后的空间选项有before skip
和after skip
。
toptitle
并bottomtitle
设置标题文字前后的空格。
\documentclass{article}
\usepackage{mwe}% <--- for testing purpose only
\usepackage[most]{tcolorbox}
\newtcolorbox[auto counter]{Problem}[1][]{%
enhanced,
breakable,
colback=white,
colbacktitle=white,
coltitle=black,
fonttitle=\bfseries,
before skip=6pt,
after skip=6pt,
boxrule=1.25pt,
titlerule=.2pt,
toptitle=1.5pt,
bottomtitle=1.5pt,
title=Problem~\thetcbcounter,
#1}
\renewcommand{\baselinestretch}{1.5}
\begin{document}
\blindtext
\begin{Problem}
\blindtext
\end{Problem}
\blindtext
\end{document}