# \usepackage{colorspace} package doesn't work with \usepackage[cmyk]{xcolor}

The xcolor package has a nice feature where you can specify a colour in multiple colour models. The appropriate colour is then picked depending on the options xcolor is loaded with.

e.g., I can define PANTONE 7740 CP in a colour palette file as:

\definecolor{PANTONE-7740-CP}{RGB/cmyk}{70,151,58/0.75,0,0.95,0.15}


then depending on whether I load xcolor with the rgb option or the cmyk option, I'll get the appropriate colour space.

Now, let's say I want to work in CMYK and also specify a spot colour or registration colour. e.g., I can define the special registration colour space using the colorspace package:

\usepackage{colorspace}
\definespotcolor{registration}{All}{1,1,1,1}


However, if I load xcolor with the cmyk option, I get errors when trying to use this registration colour.

! Argument of \c@lor@@cmyk has an extra }.
<inserted text>
\par
l.9 \textcolor{registration}{Registration colour}


If just let colorspace load xcolor then the RGB definitions from my colour palette are picked up instead of the CMYK ones, which obviously isn't what I want.

Can anyone suggest a solution?

# MWE

In this MWE, my test colour is RGB red and CMYK cyan, so you easily see which colour is in use.

\documentclass{article}
\usepackage[cmyk]{xcolor}
\usepackage{colorspace}
\definecolor{testcolour}{RGB/cmyk}{255,0,0/1,0,0,0}
\definespotcolor{registration}{All}{1,1,1,1}
\begin{document}
\textcolor{testcolour}{Test Colour}

\textcolor{registration}{Registration colour}
\end{document}


Yes, the package option cmyk calls \selectcolormodel, which, as explained in the manual, doesn't work yet. This is a limitation, which means cmyk must be selected explicitly when defining colors.

• Thanks for your answer! Is this something you might implement in the foreseeable future? – David Purton Jun 16 '18 at 1:58
• The Unicode bidi algorithm is driving me crazy, you know (there are still some issues, even when the Unicode tests passed :-( ), and this is my priority. Perhaps by the end of year. – Javier Bezos Jun 16 '18 at 8:16
• are there any pitfalls with my workaround I posted as an answer? – David Purton Jun 25 '18 at 3:12

A suitable workaround in my case is to call \selectcolormodel{natural} before setting the colour to a spot colour:

\documentclass{article}
\usepackage[cmyk]{xcolor}
\usepackage{colorspace}
\definecolor{testcolour}{RGB/cmyk}{255,0,0/1,0,0,0}
\selectcolormodel{natural}
\definespotcolor{registration}{All}{1,1,1,1}
\begin{document}
\textcolor{testcolour}{Test Colour}

{\selectcolormodel{natural}\textcolor{registration}{Registration colour}}

\textcolor{testcolour}{Test Colour}
\end{document}