我正在尝试为某些文本设置半透明背景,以便我们可以看到其背后的图像。为此,我正在使用tcolorbox
。但是,似乎我无法让它与leaflet
文档类一起工作。
有什么建议么?
\documentclass[10pt,a4paper]{leaflet}
\usepackage[many]{tcolorbox}
\newtcolorbox{mybox}[1][]{
width=\textwidth,
arc=2mm,
% auto outer arc,
boxsep=0cm,
toprule=0.5pt,
leftrule=0.5pt,
bottomrule=0.5pt,
rightrule=0.5pt,
colframe=black,
colback=white!25,
breakable,
nobeforeafter,
enhanced jigsaw,
opacityframe=0.1,
opacityback=0.5
}
\AddToBackground{1}{\put(0,415){\includegraphics[width=9.9cm]{example-image-c}}}
\begin{document}
\begin{mybox}[]
\begin{itemize}
\item a
\item b
\item c
\item d
\end{itemize}
\end{mybox}
\end{document}
答案1
leaflet 类清空了 shipout 钩子,这意味着 tikz 无法将所需的资源添加到页面。使用当前 (!) LaTeX,您可以尝试使用新的 pdfmanagement。它使用不受 leaflet 影响的不同钩子:
\DocumentMetadata{} %load new pdfmanagement, requires current latex
\documentclass[10pt,a4paper]{leaflet}
\usepackage[many]{tcolorbox}
\newtcolorbox{mybox}[1][]{
width=\textwidth,
arc=2mm,
% auto outer arc,
boxsep=0cm,
toprule=0.5pt,
leftrule=0.5pt,
bottomrule=0.5pt,
rightrule=0.5pt,
colframe=black,
colback=white!25,
breakable,
nobeforeafter,
enhanced jigsaw,
opacityframe=0.1,
opacityback=0.5
}
\AddToBackground{1}{\put(0,415){\includegraphics[width=9.9cm]{example-image-c}}}
\begin{document}
\begin{mybox}[]
\begin{itemize}
\item a
\item b
\item c
\item d
\end{itemize}
\end{mybox}
\end{document}