可破坏的 tcolorbox 解决了我的问题

可破坏的 tcolorbox 解决了我的问题

嗨,我想让 tcolorbox 可破坏,因为在我使用它的时候它似乎不是,我试图修复它,但我做不到。谢谢你的帮助

\documentclass{book}

\usepackage{amsmath,amssymb}
\usepackage{nccmath}

\usepackage{tcolorbox}
\tcbuselibrary{most}
\newtcolorbox[auto counter,
              number within=chapter,
              list inside=myexercise
              ]{myexercise}[1][]{%
    enhanced,
    title={{\begin{minipage}{\linewidth}\textbf{Ejercicio}~\thetcbcounter.~\textit{#1}\end{minipage}}},
    halign title=left,
    sharp corners,
    colback=white,
    coltitle=black,
    colbacktitle=white,
    boxrule=0pt,frame hidden,
    overlay unbroken={\draw[black,double] (interior.north west)--(segmentation.west);},
    boxed title style={%
      colframe=white, 
      boxrule=0pt,
      colback=white,
      left=0pt,
      right=0pt},
    attach boxed title to top left={xshift={-5pt}},
    underlay unbroken={\draw[help lines,step=3.8mm,black!20!white](interior.south west) grid (segmentation.east);},
    lower separated=false, 
    before lower = {\tcbsubtitle[colback=white, opacityback=0, colframe=black, opacityframe=0, boxrule=1pt, height=1cm,  width=2.55cm, valign=center]{\textbf{Solution:}}}
}
\begin{document}


\begin{myexercise}[This is an example of how this box works, and this is all I got and I want to write a little bit more]{}
Just text Just text Just text Just text Just text Just textJust text Just text Just text Just text Just text Just textJust text Just text Just text Just text Just text Just textJust text Just text Just text Just text Just text Just text
\tcblower
Just text Just text Just text Just text Just text Just textJust text Just text Just text Just text Just text Just textJust text Just text Just text Just text Just text Just textJust text Just text Just text Just text Just text Just text
\end{myexercise}

\end{document}

在此处输入图片描述

答案1

\documentclass{book}

\usepackage{amsmath,amssymb}
\usepackage{nccmath}
\usepackage{lipsum}

\usepackage{tcolorbox}
\tcbuselibrary{most}
\newtcolorbox[auto counter,
              number within=chapter,
              list inside=myexercise
              ]{myexercise}[1][]{%
    enhanced, breakable,
    title={{\begin{minipage}{\linewidth}\textbf{Ejercicio}~\thetcbcounter.~\textit{#1}\end{minipage}}},
    halign title=left,
    sharp corners,
    colback=white,
    coltitle=black,
    colbacktitle=white,
    boxrule=0pt,frame hidden,
    underlay unbroken and first={%
         \ifnumequal{\tcbsegmentstate}{0}{
            \draw[black,double] (interior.north west)--(interior.south west);
        }{\ifnumequal{\tcbsegmentstate}{1}{
                \draw[black,double] (interior.north west)--(segmentation.west);
            \begin{tcbclipinterior}
                    \draw[help lines, step=3.8mm, black!20!white](segmentation.south west) grid (frame.south east);
            \end{tcbclipinterior}
        }{\ifnumequal{\tcbsegmentstate}{2}{
            \begin{tcbclipinterior}
                    \draw[help lines, step=3.8mm, black!20!white](interior.north west) grid (interior.south east);
            \end{tcbclipinterior}
        }}}
    },
    underlay middle and last={%
         \ifnumequal{\tcbsegmentstate}{0}{
            \draw[black,double] (interior.north west)--(interior.south west);
        }{\ifnumequal{\tcbsegmentstate}{1}{
                \draw[black,double] (interior.north west)--(segmentation.west);
            \begin{tcbclipinterior}
                    \draw[help lines, step=3.8mm, black!20!white](segmentation.south west) grid (frame.south east);
            \end{tcbclipinterior}
        }{\ifnumequal{\tcbsegmentstate}{2}{
            \begin{tcbclipinterior}
                    \draw[help lines, step=3.8mm, black!20!white](interior.north west) grid (interior.south east);
            \end{tcbclipinterior}
        }}}
    },
    boxed title style={%
      colframe=white, 
      boxrule=0pt,
      colback=white,
      left=0pt,
      right=0pt},
    attach boxed title to top left={xshift={-5pt}},
    lower separated=false, 
    before lower = {\tcbsubtitle[colback=white, opacityback=0, colframe=black, opacityframe=0, boxrule=1pt, height=1cm,  width=2.55cm, valign=center]{\textbf{Solution:}}}
}
\begin{document}


\begin{myexercise}[This is an example of how this box works, and this is all I got and I want to write a little bit more]{}
\lipsum[1-10]
\tcblower
\lipsum[1-10]
\end{myexercise}

\end{document}

在此处输入图片描述

相关内容