我参考了这个问题: 软件包 pgfkeys:我不知道密钥“/tcb/O”,我将忽略它 并接受答案。如果问题和/或答案的文本跨越下一页,如下所示:
左箭头未跨越下一页(两个 tcolobox 都可破坏)。我们能解决这个问题吗?
答案1
您需要声明breakable
盒子,并将侧线调整为相应类型的盒子:不间断、第一个、中间或最后一个。
\documentclass{article}
\usepackage[margin=2cm]{geometry}
\usepackage[T1]{fontenc}
\usepackage{tcolorbox,tikz}
\usepackage{lipsum,lmodern}
\usetikzlibrary{calc}
\tcbuselibrary{skins,listings,breakable,poster}
\newtcolorbox[auto counter]{example}[2]{%
enhanced, breakable,
left skip=1cm,attach boxed title to top text left={yshift=-\tcboxedtitleheight/2,yshifttext=-2mm},
boxed title style={colframe=#1!40!white,arc=3mm},
colback=#1!10!white,colframe=#1!10!white,coltitle=black,colbacktitle=#1!10!white,
fonttitle=\bfseries,
title=Example,
underlay boxed title={
\node [circle,fill=#1!10!white,draw=#1!40!white,inner sep=1pt] (A) at ($(title.west) + (-8mm,0)$){\thetcbcounter};
},
underlay unbroken={
\draw[#1!40!white,-{stealth}] (title.west) -- (A) -- (frame.south west-|A);},
underlay first={
\draw[#1!40!white] (title.west) -- (A) -- (frame.south west-|A);},
underlay middle={
\draw[#1!40!white] (frame.north west-|A) -- (frame.south west-|A);},
underlay last={
\draw[#1!40!white,-{stealth}] (frame.north west-|A) -- (frame.south west-|A);},
#2
}
\newtcolorbox[auto counter]{sol}[2]
{%
enhanced, breakable,
left skip=1cm,attach boxed title to top text left={yshift=-\tcboxedtitleheight/2,yshifttext=-2mm},
boxed title style={colframe=#1!40!white,arc=3mm},
colback=#1!10!white,colframe=#1!10!white,coltitle=black,colbacktitle=#1!10!white,
fonttitle=\bfseries,
title=Solution,
underlay boxed title={
\node [circle,fill=#1!10!white,draw=#1!40!white,inner sep=1pt] (A) at ($(title.west) + (-8mm,0)$){\thetcbcounter};
},
underlay unbroken={
\draw[#1!40!white,-{stealth}] (title.west) -- (A) -- (frame.south west-|A);},
underlay first={
\draw[#1!40!white] (title.west) -- (A) -- (frame.south west-|A);},
underlay middle={
\draw[#1!40!white] (frame.north west-|A) -- (frame.south west-|A);},
underlay last={
\draw[#1!40!white,-{stealth}] (frame.north west-|A) -- (frame.south west-|A);},
#2
}
\begin{document}
\begin{example}{blue}{}
Our Example
\lipsum[1-20]
\end{example}
\begin{sol}{red}{}
here is the solution
\lipsum[1-3]
\end{sol}
\end{document}