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}
3

1 Answer 1

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

8
  • How can I compile this?
    – Tom
    Commented Jun 10, 2022 at 23:58
  • @Tom with the newest pdflatex, or with pdflatex-dev, or with by first loading pdfmanagement-testphase Commented Jun 11, 2022 at 6:23
  • I see. Thank you! I try it successfully on local compile. But not working on overleaf, that's could need some time.
    – Tom
    Commented Jun 11, 2022 at 7:25
  • @Tom On overleaf you could try to load pdfmanagement-testphase and then use \DeclareDocumentMetadata as command (we shortened the name in newer latex). But I'm not sure if all the needed patches are already there in overleaf. Commented Jun 11, 2022 at 7:29
  • 1
    @Philippe add this \RequirePackage{pdfmanagement-testphase} \DeclareDocumentMetadata{} before \documentclass command.
    – Tom
    Commented Jun 12, 2022 at 17:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .