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.

5

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.