如何将tcolorbox
的框式标题移到前景上(移到框的前面)?如您在屏幕截图(红色矩形,我的高亮部分)中看到的,网格与标题重叠,这种行为是不受欢迎的。
\documentclass[]{article}
\usepackage[most]{tcolorbox}
\NewTColorBox{solution}{+O{}}{%
breakable,
enhanced,
sharpish corners,
colframe=blue!50,
colback=white,
coltitle=blue!50,
parbox = false,
fonttitle=\bfseries,
title={Solution},
attach boxed title to top center ={yshift=-\tcboxedtitleheight/2,yshifttext=-\tcboxedtitleheight/2},
halign title=flush center,
boxed title style={%
colback=white,
},
boxrule=0.5mm,top=0mm,bottom=0mm,
underlay={%
\draw[help lines,step=5mm,blue!20!white,shift={(interior.north west)}]
(interior.south west) grid (interior.north east);
},
lowerbox=ignored,
#1
}
\begin{document}
\begin{solution}
Some text
\end{solution}
\end{document}
答案1
underlay boxed title
在添加方框标题之前绘制underlay
网格,导致方框标题出现在前景中(另请参阅手册第 200 页tcolorbox
):
\documentclass[]{article}
\usepackage[most]{tcolorbox}
\NewTColorBox{solution}{+O{}}{%
breakable,
enhanced,
sharpish corners,
colframe=blue!50,
colback=white,
coltitle=blue!50,
parbox = false,
fonttitle=\bfseries,
title={Solution},
attach boxed title to top center ={yshift=-\tcboxedtitleheight/2,yshifttext=-\tcboxedtitleheight/2},
halign title=flush center,
boxed title style={%
colback=white,
},
boxrule=0.5mm,top=0mm,bottom=0mm,
underlay boxed title={%
\draw[help lines,step=5mm,blue!20!white,shift={(interior.north west)}]
(interior.south west) grid (interior.north east);
},
lowerbox=ignored,
#1
}
\begin{document}
\begin{solution}
Some text
\end{solution}
\end{document}