tcolorbox 包中的示例存在问题

tcolorbox 包中的示例存在问题

当我尝试从手册中运行这个简单示例时:

\documentclass{report}
\begin{document}
\tcbset{frame style={top color=red!20!white,
                     bottom color=red!20!white!75!black},
        fonttitle=\bfseries,coltitle=black}

\begin{tcolorbox}[enhanced,title=My title,interior hidden]
This is a \textbf{tcolorbox}.
\tcblower
This is the lower part.
\end{tcolorbox}
\end{document}

我收到一个奇怪的错误:


! Package pgfkeys Error: I do not know the key '/tcb/frame style', to which you
 passed 'top color=red!20!white, bottom color=red!20!white!75!black', and I am
going to ignore it. Perhaps you misspelled it.

See the pgfkeys package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                             

l.82         fonttitle=\bfseries,coltitle=black}

-------------------------------------------------------------------------------------------------

我在 Stack Exchange 和其他论坛上看到,问题在于的版本过时,但我正在运行的和的tcolorbox最新版本,这里插入了日志文件中的内容:tcolorboxPGF

Package: tcolorbox 2015/03/16 version 3.50 text color boxes

Package: pgf 2013/12/18 v3.0.0 (rcs-revision 1.14)

有人可以解释一下这个问题吗?

答案1

您必须加载适当的库才能frame style解决问题。这里是skins。如果有疑问,您可以添加mostmany作为选项tcolorbox

\documentclass{report}
\usepackage[skins]{tcolorbox}
%\usepackage[most]{tcolorbox}
\begin{document}
\tcbset{frame style={top color=red!20!white,
                     bottom color=red!20!white!75!black},
        fonttitle=\bfseries,coltitle=black}

\begin{tcolorbox}[enhanced,title=My title,interior hidden]
This is a \textbf{tcolorbox}.
\tcblower
This is the lower part.
\end{tcolorbox}
\end{document}

在此处输入图片描述

相关内容