4

I have vector graphic created with Adobe Illustrator CS4 saved as PDF, it looks like:

enter image description here

You can download the PDF here.

As you can see, the lines are black.


If I include the PDF with \includegraphics in a beamer document which has a changed foreground color, all lines of my graphic get colored in that color!

\documentclass{beamer}
\usepackage{graphicx}
\setbeamercolor{normal text}{bg=white,fg=red}
\begin{document}
\begin{frame}
\includegraphics[width=0.5\textwidth]{dummy.pdf}
\end{frame}
\end{document}

enter image description here

Oh yes, that's unexpected.

What goes wrong? Is that really intended behaviour?

How do I get my lines black again?

If it's a problem related to the graphicx package, I'd prefer a solution by that package. But a beamer workaround would be fine as well. I tried to locally set

\setbeamercolor{normal text}{bg=white,fg=black}

but it does not have any effect. Also I need the foreground color as it is (non-black), just the graphic should be affected by the change.

0

1 Answer 1

6

The included PDF file does not contain a color operator. Driver pdftex.def does not set a default color by default, thus the current color is used. The behavior of driver pdftex.def can be changed by setting resetcolor, either as option in \includegraphics or via:

\setkeys{Gin}{resetcolor}

However, this will not work here, because the normal color is red in this beamer document, see fg=red. But, the traditional \textcolor{black}{...} helps:

\documentclass{beamer}
\usepackage{graphicx}
\setbeamercolor{normal text}{bg=white,fg=red}
\begin{document}
\begin{frame}
\textcolor{black}{\includegraphics[width=0.5\textwidth]{dummy.pdf}}
\end{frame}
\end{document}

Result

1
  • Note this can be done globally with the following: \LetLtxMacro\latexincludegraphics\includegraphics \renewcommand{\includegraphics}[2][]{\textcolor{black}{\latexincludegraphics[#1]{#2}}}
    – tdc
    Nov 10, 2017 at 12:16

You must log in to answer this question.

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