With package xespotcolor
, I can define and use spot colors with XeLaTeX
. This works, even together with tikz
.
I am, however, having trouble when I try to use spot colors in externalized tikz pictures. The pdf
file produced for the picture is corrupt, and, as a consequence, the final pdf file after including the picture (second tex run) as well.
I have tracked down the problem to a color space definition being missing in the picture pdf. There should be code as follows in the pdf
/ColorSpace <<
/PANTONE285C [
/Separation
/PANTONE#20285#20C
/DeviceCMYK
632 0 R
]
>>
but there isn't. It seems that tikzexternalize
skips the output generated by xespotcolor
when generating the picture pdf.
Is there any way to force tikzexternalize
not to skip something when generating the picture pdf? Or to include particular code in every picture pdf? I need something like a hook.
Minimum non-working example -- compiling it by xelatex --shell-escape [filename]
produces a corrupt figure pdf, where the color space definition is missing.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{external}
\tikzexternalize
\RequirePackage[xcolor]{xespotcolor}
\NewSpotColorSpace{PANTONE}
\AddSpotColor{PANTONE}{PANTONE285C}{PANTONE\SpotSpace 285\SpotSpace C} {1 .45 0 0.19}
\SetPageColorSpace{PANTONE}
\definecolor{myblue}{spotcolor}{PANTONE285C,1.0}
\begin{document}
\begin{tikzpicture}
\draw [myblue] (0,0) -- (2,0);
\end{tikzpicture}
\end{document}