當我嘗試運行手冊中的這個簡單範例時:
\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}