如果将颜色空间用于节点标签,则会产生神秘错误

如果将颜色空间用于节点标签,则会产生神秘错误

我尝试使用 colorspace 包来获取用于打印的真彩色。但是,我收到以下错误:

! Undefined control sequence.
\color@&spot ...->\c@lor@arg {#2}\edef #1{\spc@ir\space cs \spc@ir \space C
1.9 \node[label={[MyColor]:Hello}] at (2,0){};

! Undefined control sequence.
\color@&spot ...->edef #1{\spc@ir \space cs \spc@ir\space CD #2 sc #2 SC}
1.9 \node[label={[MyColor]:Hello}] at (2,0){};

运行以下 MWE:

\documentclass{article}
\usepackage{colorspace}
\usepackage{tikz}
\definespotcolor{MyColor}{PANTONE 2736 C}{0.97,0.95,0,0}
\begin{document}
\begin{tikzpicture}
\fill[MyColor] (0,0) rectangle(1,1);
\node[label={[green]:Hello}] at (2,-1){};
\node[label={[MyColor]:Hello}] at (2,0){};
\end{tikzpicture}
\end{document}[![enter image description here][1]][1]

两个错误都发生在第 9 行。使用第 7 行中填充矩形的颜色没有问题,使用第 8 行中标签的标准颜色也可以。具体来说,输出是正确的:

正确的输出

\definespotcolor 的语法是

\definespotcolor{<latex-name>}{<PDF-name>}{<CMYK-equivalent>} 

答案1

作为一种解决方法,我建议使用\color{MyColor}语法而不是[MyColor]:

\documentclass{article}
\usepackage{colorspace}
\usepackage{tikz}
\definespotcolor{MyColor}{PANTONE 2736 C}{0.97,0.95,0,0}
\begin{document}
\begin{tikzpicture}
\fill[MyColor] (0,0) rectangle(1,1);
\node[label={\color{green}Hello}] at (2,-1){};
\node[label={\color{MyColor}Hello}] at (2,0){};
\end{tikzpicture}
\end{document}

相关内容