tcolorbox 无背景颜色(透明)

tcolorbox 无背景颜色(透明)

我想在 tcolorbox 中有透明背景。

大多数时候colback=white是一种解决方法,但它并不干净。

\documentclass{article}
\usepackage{pagecolor}
\pagecolor{yellow}
\usepackage{tcolorbox}
\begin{document}
\begin{tcolorbox}[
    title=Title,
%   opacityback=1,  % this does not work
%   colback=white,  % this is not what I want
]
This should have transparent backround. \\
Background should look yellow. 
\end{tcolorbox}
\end{document}

答案1

感谢 flav。

tcolorbox 中的透明背景只有使用 skin 键才可实现standard jigsaw。否则该键无效opacityback=0

\documentclass{article}
\usepackage{xcolor}
\usepackage{pagecolor}
\pagecolor{yellow}
\usepackage{tcolorbox}
\begin{document}
\begin{tcolorbox}[
    standard jigsaw,
    title=Title,
    opacityback=0,  % this works only in combination with the key "standard jigsaw"
]
This should have transparent backround. \\
Background should look yellow. 
\end{tcolorbox}
\end{document}

答案2

您必须使用增强型:

\documentclass{article}
\usepackage{pagecolor}
\pagecolor{yellow}
\usepackage{tcolorbox}
\tcbuselibrary{skins}
\begin{document}
\begin{tcolorbox}[enhanced,
  title=Title,
  opacityframe=.5,
   opacityback=.5,  % this does not work
%   colback=white,  % this is not what I want
]
This should have transparent backround. \\
Background should look yellow. 
\end{tcolorbox}
\end{document}

相关内容