Skip to content

wrong spot colors after \colorlet #11

@u-fischer

Description

@u-fischer

pgf assigns some colors using the implicit color . and the pseudo model named. Both doesn't work with colorspace:

\documentclass{article}
\usepackage{colorspace}

\definespotcolor{myblue}{HKS 44 K}[cmyk]{1,0.5,0,0}
\begin{document}

\colorlet{.}{myblue}

\colorlet{implicittest}{.}

\expandafter\show\csname\string\color@implicittest\endcsname

\color{red} aaa 

\expandafter\show\csname\string\color@.\endcsname

\colorlet[named]{namedtest}{myblue}

\expandafter\show\csname\string\color@namedtest\endcsname
\end{document}

This gives the two invalid colors (and so breaks the pdf):

> \\color@implicittest=macro:
->\xcolor@ {}{0 cs 0 CS 1 sc 1 SC}{&spot}{1}.
                                                  
> \\color@namedtest=macro:
->\xcolor@ {}{0 cs 0 CS 1 sc 1 SC}{&spot}{1}.

I would suggest to add similar to issue #10 a light weight test to \spc@getref if it actually got a correct spot color.

This doesn't resolve everything. If there is a second spotcolor and \colorlet[named]{namedtest}{myred} is used, then it gets the wrong color. But at least there is a warning and the pdf is not broken.

\documentclass{article}
\usepackage{colorspace}

\definespotcolor{myblue}{HKS 44 K}[cmyk]{1,0.5,0,0}

\makeatletter
\ExplSyntaxOn
\def\spc@getref#1~#2\@@
 {
  \tl_if_head_eq_charcode:nNTF {#1}/
   {\gdef\spc@ir{#1}}
   {
    \PackageWarning{colorspace}{#1~is~not~a~spot~color!\MessageBreak
     Trying~implicit~color~.}{}
     \spc@getir{\string\color@.}
     \tl_if_head_eq_charcode:fNF {\spc@ir}/
      {
       \PackageError{colorspace}{#1~is~not~a~spot~color!}{}
      }
   }
 }
\ExplSyntaxOff\makeatother

\begin{document}

\colorlet{.}{myblue}

\colorlet{implicittest}{.}

\expandafter\show\csname\string\color@implicittest\endcsname

\color{red} aaa 

\expandafter\show\csname\string\color@.\endcsname

\colorlet[named]{namedtest}{myblue}

\expandafter\show\csname\string\color@namedtest\endcsname
\end{document}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions