ho-tex / transparent

transparent package for LaTeX
LaTeX Project Public License v1.3c
2 stars 0 forks source link

no effect for \includegraphics{...pdf} #8

Closed grogorick closed 7 months ago

grogorick commented 7 months ago

It seems to have no effect when including PDFs as images, e.g. this does not work: \transparent{0.5}\includegraphics{figures/fig1.pdf}} while this works: \transparent{0.5}\includegraphics{figures/fig1.png}}

To provide some context, I usually include vector images in PDF format.

u-fischer commented 7 months ago

Always provide a small but complete example and use images that are available (You can use example-image.pdf and example-image.png).

u-fischer commented 7 months ago

I can not confirm that it doesn't work:

\documentclass{article}
\usepackage{graphicx}
\usepackage{transparent}
\begin{document}
x\rlap{XXXXXXXXXXXXXXXXXXXXXXXXX}%
\includegraphics[width=5cm]{example-image-a}

x\rlap{XXXXXXXXXXXXXXXXXXXXXXXXX}%
\texttransparent{0.5}{\includegraphics[width=5cm]{example-image-a}}

x\rlap{XXXXXXXXXXXXXXXXXXXXXXXXX}%
\texttransparent{0.5}{\includegraphics[width=5cm]{example-image-a.png}}
\end{document}

gives

image

grogorick commented 7 months ago

Thx for your quick reply and sorry for the incomplete example.

I'm actually getting the same error when using your code (on Overleaf, if that matters). Maybe it's an issue with some opacity props within the PDF? I'm using the following: age_distribution_bar.pdf age_distribution_bar.png

u-fischer commented 7 months ago

on overleaf my example didn't work at all as it should be example-image-a and not example-image-A, but apart from this it transparency is fine. And yes, your PDF contains its own opacity settings and so they win. There is nothing the transparent package can do about it.