1

I am trying to set a semi-transparent background for some text, so we can see the image behind it. To do so, I am using tcolorbox. However, it seems that I can not get it working with the leaflet document class.

Any suggestions?

\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
    It appears tcolorbox is incompatible with leaflet.cls. TikZ works, but even the simplest tcolorbox does nothing. – John Kormylo Jun 10 '22 at 20:16
  • 1
    You could try flowfram instead of leaflet. See https://tex.stackexchange.com/questions/248182/number-of-pages-in-leaflet/248248?r=SearchResults&s=24%7C10.5390#248248 – John Kormylo Jun 10 '22 at 20:31
  • similar issue here https://tex.stackexchange.com/questions/452459/use-opacity-from-tikz-in-leaflet-documentclass – Tom Jun 10 '22 at 21:00

1 Answers1

3

The leaflet class empties the shipout hooks and this means that tikz can't add the needed resources to the page. With a current (!) LaTeX you could try to use the new pdfmanagement. It uses a different hook that is not affected by 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}

enter image description here

Ulrike Fischer
  • 327,261