当我尝试从手册中运行这个简单示例时:
\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
最新版本,这里插入了日志文件中的内容:tcolorbox
PGF
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
。如果有疑问,您可以添加most
或many
作为选项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}