如果我给出下一个段落,则 \DeclareTotalTColorBox 中出现错误

如果我给出下一个段落,则 \DeclareTotalTColorBox 中出现错误

我的标签如下:

\documentclass{book}

\usepackage{environ} %fancy boxes
\usepackage{xcolor}
\usepackage[tikz]{bclogo}

\usepackage{etoolbox}
\usepackage{blindtext}%
\usepackage[skins,breakable,xparse]{tcolorbox}%

\bibliographystyle{mit-chicago}

\DeclareTotalTColorBox[auto counter]{\myexer}{ O{} m }
{ enhanced,breakable,
  boxrule=0pt,boxsep=0pt,arc=2mm,toptitle=12pt,beforeafter skip=17pt,top=3mm,left=7mm,right=12pt,pad at break=2mm,
%  colframe=yellow!20!white,interior hidden,
  colframe=black!10,interior hidden,
  coltitle=black,fonttitle=\bfseries\large,title={\hspace*{10pt}Exercise}, %title={Exercise~\thetcbcounter},
  overlay unbroken and first={\node at ([xshift=20pt,yshift=-21pt]frame.north west) {\bccrayon};},
  #1}
  {#2}


\begin{document}

\myexer{
\begin{center} \textbf{Selling Bicycles} \end{center}
Imagine you buy and sell bicycles from your small store. One day, you receive a customer, Yuya, who tells you the following: ``I want to buy a bicycle whose price is \$200, but I am only willing to pay \$100 for it.'' You know that the total cost of each bicycle is \$160, with \$70 the sum of variable costs and \$90 the sum of \emph{allocated} fixed costs.

Next paragraph text follows here:%%If I remove this enter mark, then it works
\begin{enumerate}
    \item Would you sell the bicycle for \$100? (Ignore taxes when making your calculations.)
\end{enumerate}
}


\end{document}

上面的代码运行正常,如果我删除para enter,但我有许多段落文本,我该如何解决这个问题?请指教...

答案1

您需要在强制参数中允许段落,该参数是使用+m而不是获得的m

\documentclass{book}

\usepackage{environ} %fancy boxes
\usepackage{xcolor}
\usepackage[tikz]{bclogo}

\usepackage{etoolbox}
\usepackage{blindtext}%
\usepackage[skins,breakable,xparse]{tcolorbox}%

\bibliographystyle{mit-chicago}

\DeclareTotalTColorBox[auto counter]{\myexer}{ O{} +m }
 {
  enhanced,breakable,
  boxrule=0pt,
  boxsep=0pt,
  arc=2mm,
  toptitle=12pt,
  beforeafter skip=17pt,
  top=3mm,
  left=7mm,
  right=12pt,
  pad at break=2mm,
  %colframe=yellow!20!white,
  colframe=black!10,
  interior hidden,
  coltitle=black,
  fonttitle=\bfseries\large,
  title={\hspace*{10pt}Exercise},
  %title={Exercise~\thetcbcounter},
  overlay unbroken and first={\node at ([xshift=20pt,yshift=-21pt]frame.north west) {\bccrayon};},
  #1
}{#2}


\begin{document}

\myexer{
  \begin{center} \textbf{Selling Bicycles} \end{center}
  Imagine you buy and sell bicycles from your small store. One day, you receive a 
  customer, Yuya, who tells you the following: ``I want to buy a bicycle whose price 
  is \$200, but I am only willing to pay \$100 for it.'' You know that the total cost 
  of each bicycle is \$160, with \$70 the sum of variable costs and \$90 the sum of 
  \emph{allocated} fixed costs.
  interior hidden,

  Next paragraph text follows here:
  \begin{enumerate}
    \item Would you sell the bicycle for \$100? (Ignore taxes when making your calculations.)
  \end{enumerate}
}


\end{document}

在此处输入图片描述

相关内容