![tcbset 错误,带有可选颜色参数和“附加盒装标题”](https://linux22.com/image/451498/tcbset%20%E9%94%99%E8%AF%AF%EF%BC%8C%E5%B8%A6%E6%9C%89%E5%8F%AF%E9%80%89%E9%A2%9C%E8%89%B2%E5%8F%82%E6%95%B0%E5%92%8C%E2%80%9C%E9%99%84%E5%8A%A0%E7%9B%92%E8%A3%85%E6%A0%87%E9%A2%98%E2%80%9D.png)
tcolorbox
我在涉及tcbset
、newtcbtheorem
可选颜色参数和时遇到问题attach boxed title to ...
。错误如下:
Package xcolor Error: Undefined color `visible'.
以下是示例代码:
\documentclass[a4paper, 11pt]{report}
\usepackage[many]{tcolorbox}
\tcbset{
titlebox/.style={
colframe=#1!50!white,
attach boxed title to top left,
}
}
\newtcbtheorem[number within=section]%
{theo}
{Théorème}
{titlebox=red}
{theo}
\begin{document}
\begin{theo}{Test}{}
Test.
\end{theo}
\end{document}
我不知道为什么会发生这种情况。如果有人知道,请告诉我。提前谢谢 :)
答案1
titlebox 是 tcolorbox 的已知键。通过覆盖它,您会混淆代码。您还缺少增强键。
\documentclass[a4paper, 11pt]{report}
\usepackage[many]{tcolorbox}
\tcbset{
mytitlebox/.style={
enhanced,
colframe=#1!50!white,
attach boxed title to top left,
}
}
\newtcbtheorem[number within=section]%
{theo}
{Théorème}
{mytitlebox=red}
{theo}
\begin{document}
\begin{theo}[title=Title]{Test}{xxx}
Test.
\end{theo}
\end{document}