\NewTColorBox 中易碎 - 无法编译

\NewTColorBox 中易碎 - 无法编译
\documentclass[12pt,a4paper]{report}
\usepackage{amsmath,amsthm,amssymb}
\usepackage{enumerate}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Example and Solution
%
\usepackage{tcolorbox}
\tcbuselibrary{skins,xparse}
\tcbset{%
    colback=white,
    tikz={opacity=0.1,transparency group},
    colframe=black,
    title filled=false,
%   bookmark={Q\arabic{\tcbcounter}}
}
\NewTColorBox[
    auto counter,
    number within=section
    ]{example}{ +O{}mo }{%
    fonttitle    = \bfseries,
    breakable,
    title        = {Example~\thetcbcounter:~ #2},
    before lower = {\textbf{Solution~\thetcbcounter:\quad}},
    lowerbox     = invisible, %invisible/ignored
% after title/after upper
    IfValueTF={#3}{after title={\hfill\colorbox{red}{\texttt #3 }}}{},
    #1
}%



\begin{document}

\begin{example}
test
\end{example}


\end{document}

我该如何改变,以便我可以使用包breakable中的功能tcolorbox

目前,它无法编译并给出错误:在此处输入图片描述

答案1

请将选项放入breakable\tcbuselibrary例如

\tcbuselibrary{skins,xparse,breakable}

修改MWE为:

\documentclass[12pt,a4paper]{report}
\usepackage{amsmath,amsthm,amssymb}
\usepackage{enumerate}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Example and Solution
%
\usepackage{tcolorbox}
\tcbuselibrary{skins,xparse,breakable}
\tcbset{%
    colback=white,
    tikz={opacity=0.1,transparency group},
    colframe=black,
    title filled=false
%   bookmark={Q\arabic{\tcbcounter}}
}
\NewTColorBox[
    auto counter,
    number within=section
    ]{example}{ +O{}mo }{%
    fonttitle    = \bfseries,
    title        = {Example~\thetcbcounter:~ #2},
    before lower = {\textbf{Solution~\thetcbcounter:\quad}},
    lowerbox     = invisible, %invisible/ignored
% after title/after upper
    IfValueTF={#3}{after title={\hfill\colorbox{red}{\texttt #3 }}}{},
    #1
}%



\begin{document}

\begin{example}
test
\end{example}


\end{document}

相关内容