\newtcbtheorem (tcolorbox) + enumerate 环境 (enumitem 包): \tcb@@icolorbox 的使用与其定义不符

\newtcbtheorem (tcolorbox) + enumerate 环境 (enumitem 包): \tcb@@icolorbox 的使用与其定义不符

我喜欢强大的库彩色盒子。但我发现自己很难将\newtcbtheorem第 17 章中描述的内容与枚举项包。我最简单的定理定义如下:

\RequirePackage[most]{tcolorbox}
  \newtcbtheorem[auto counter,number within=chapter]{mathexam}{Příklad}{%
    enforce breakable,         % breakable,
    compress page,
    enhanced,
  }{mai}

然后我想像这样使用它:

  \begin{mathexam}{Find the prmitive functions for:
    \begin{enumerate}
      \item \(f(x) = 2x+5\),
      \item \(f(x) = \sin x\),
      \item \(f(x) = \dfrac{1}{\sqrt{1-x^2}}\),
    \end{enumerate}
    }{mai:exam118}
    \blindmathtrue
    \blindmathpaper
  \end{mathexam}

我也尝试补丁

% https://tex.stackexchange.com/questions/566094/
% Twoline title with the description starting below “Theorem #”
\makeatletter
\xpatchcmd\tcb@theo@title
  {\hangindent\wd\z@\hangafter=1}
  {}
  {}{\fail}
\makeatother

但编译器并不满意:

! Use of \tcb@@icolorbox doesn't match its definition.
\@ifnextchar ... \reserved@d =#1\def \reserved@a {
                                                  #2}\def \reserved@b {#3}\f...

l.37     }{mai:exam118}

我的完整 MNWE 是:

\documentclass{scrbook}
  \usepackage[math]{blindtext}
  \usepackage{xpatch}
  \usepackage{enumitem}

\RequirePackage[most]{tcolorbox}
  \newtcbtheorem[auto counter,number within=chapter]{mathexam}{Příklad}{%
    enforce breakable,         % breakable,
    compress page,
    enhanced,
  }{mai}

    % https://texblog.org/2013/02/27/on-paragraphs-in-texlatex/
    % https://tex.stackexchange.com/questions/566094/
    % Twoline title with the description starting below “Theorem #”
    \makeatletter
    \xpatchcmd\tcb@theo@title
      {\hangindent\wd\z@\hangafter=1}
      {}
      {}{\fail}
    \makeatother
  
\begin{document}
  \begin{mathexam}{Find the prmitive functions for:
    \begin{enumerate}
      \item \(f(x) = 2x+5\),
      \item \(f(x) = \sin x\),
      \item \(f(x) = \dfrac{1}{\sqrt{1-x^2}}\),
    \end{enumerate}
    }{mai:exam118}
    \blindmathtrue
    \blindmathpaper
  \end{mathexam}
\end{document}

相关内容