![如何定制易碎盒子](https://linux22.com/image/396800/%E5%A6%82%E4%BD%95%E5%AE%9A%E5%88%B6%E6%98%93%E7%A2%8E%E7%9B%92%E5%AD%90.png)
在下面的例子中,我的易碎盒子出现了问题,他不想骑。
\documentclass[12pt,a4paper,oneside,openright]{book}
\usepackage[utf8]{inputenc}
\usepackage[frenchb]{babel}
\usepackage[most]{tcolorbox}
\usepackage{multicol}
\usepackage{lipsum}
\usepackage[left=4cm,right=3cm,top=3cm,bottom=3cm]{geometry}
\usepackage{etoolbox}
\definecolor{tcbcolback}{RGB}{255,128,0}
\usepackage{varwidth}
\newtcolorbox{mybox}[2][]{enhanced,
before skip=0mm,after skip=0mm,
colback=black!5,colframe=black!50,boxrule=0.2mm,
height fixed for=first and middle,
attach boxed title to top left={xshift=1cm,yshift*=1mm-\tcboxedtitleheight},
varwidth boxed title*=-3cm,boxrule=1pt,breakable,pad at break*=0mm,colframe=green!75!black,drop lifted shadow,
boxed title style={frame code={
\path[fill=tcbcolback!60!black]
([yshift=-1mm,xshift=-1mm]frame.north west)
arc[start angle=0,end angle=180,radius=1mm]
([yshift=-1mm,xshift=1mm]frame.north east)
arc[start angle=180,end angle=0,radius=1mm];
\path[left color=tcbcolback!90!black,right color=tcbcolback!90!black,
middle color=tcbcolback!99!black]
([xshift=-2mm]frame.north west) -- ([xshift=2mm]frame.north east)
[rounded corners=1mm]-- ([xshift=1mm,yshift=-1mm]frame.north east)
-- (frame.south east) -- (frame.south west)
-- ([xshift=-1mm,yshift=-1mm]frame.north west)
[sharp corners]-- cycle;
},interior engine=empty,
},
fonttitle=\bfseries,
title={#2},#1}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NewTColorBox[auto counter,number within=chapter]{exercise}{m+O{}}{%
enhanced jigsaw,enforce breakable,pad at break=0mm,break at=-20pt,
colframe=green!20!black,
colback=yellow!10!white,
coltitle=green!40!black,
fonttitle=\bfseries,
underlay={\begin{tcbclipinterior}
\shade[inner color=green!80!yellow,outer color=yellow!10!white]
(interior.north west) circle (2cm);
\draw[help lines,step=5mm,yellow!80!black,shift={(interior.north west)}]
(interior.south west) grid (interior.north east);
\end{tcbclipinterior}},
title={Exercise~ \thetcbcounter:},
label={exercise:#1},
attach title to upper=\quad,
after upper={\par\hfill\textcolor{green!40!black}%
{\itshape Solution on page~\pageref{solution:#1}}},
lowerbox=ignored,
savelowerto=solutions/exercise-\thetcbcounter.tex,
record={\string\solution{#1}{solutions/exercise-\thetcbcounter.tex}},
#2
}
\NewTotalTColorBox{\solution}{mm}{%
enhanced,
colframe=red!20!black,
colback=yellow!10!white,
coltitle=red!40!black,
fonttitle=\bfseries,
underlay={\begin{tcbclipinterior}
\shade[inner color=red!50!yellow,outer color=yellow!10!white]
(interior.north west) circle (2cm);
\draw[help lines,step=5mm,yellow!80!black,shift={(interior.north west)}]
(interior.south west) grid (interior.north east);
\end{tcbclipinterior}},
title={Solution of Exercise~\ref{exercise:#1} on page~\pageref{exercise:#1}:},
phantomlabel={solution:#1},
attach title to upper=\par,
}{\input{#2}}
\tcbset{no solution/.style={no recording,after upper=}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\begin{mybox}[]{Exercises }
\begin{exercise}{Ex1}[coltitle=cyan!80!black]
\lipsum[1-2]
\end{exercise}
\begin{exercise}{Ex2}[coltitle=cyan!80!black]
\lipsum[1-6]
\end{exercise}
\end{mybox}
\end{document}