# [luatex] CMYK colors and transparency

Reinhard Kotucha reinhard.kotucha at web.de
Sun Jan 22 01:02:35 CET 2012

Hi,
please apologize for being off-topic.  The problem is not directly
related to LuaTeX, but I ask here because I know that all PDF experts
are on this list.

The logo of the company I'm working with for a couple of months
contains the cmyk color 1 0 0.45 0 (HKS 51).  The color is represented
properly in PDF files, unless the file contains transparent objects on
the same page.  In the latter case the color looks greenish in Adobe

Here is a simple example file:

-------------------------------------------------------
\pdfcompresslevel=0

\documentclass{article}
\usepackage{color}
\usepackage{tikz}
\pagestyle{empty}

\begin{document}
\textcolor[cmyk]{1,0,0.45,0}{\rule{1cm}{1cm}}
\newpage
\tikz{\fill[semitransparent,red] (0,0) circle (5mm);}
\textcolor[cmyk]{1,0,0.45,0}{\rule{1cm}{1cm}}

\end{document}
-------------------------------------------------------

The the color of the square on the first page is correct, on the
second page it looks correct if you either

* comment out the \tikz command,

* or remove the 'semitransparent' option,

My first thought was that this particular color is quite critical due
to its large portion of yellow.  Assuming a maybe too simplistic
transformation from CMYK to RGB, like

red   = 1 - cyan
green = 1 - magenta
blue  = 1 - yellow

, I would expect it to look greenish.  Indeed, the HKS RGB
definition of HKS51 is 0, 0.64314, 0.643141 (#00a4a4) and

\textcolor[cmyk]{1,0,0.45,0}{\rule{1cm}{1cm}}
\textcolor[rgb]{0,0.64314,0.643141}{\rule{1cm}{1cm}}

look very similar.

It seems that Tikz defines a dedicated RGB color space if transparency
is involved.  However, the PDF file contains the line

1 0 0.45 0 k 1 0 0.45 0 K

and the PDF spec says that K sets both, the color *and* the color
space.  Doesn't it mean that it overrides any color space set up
anywhere else?

Curiously enough, xpdf and gv display everything correctly.  Thus, I
assume that the problem is caused by an Acrobug.

Maybe some PDF expert can answer the following questions:

* Does the way TikZ applies its color space comply 100% with the PDF
specification?

* Is there a way to restrict the color space applied by TikZ to act
on the TikZ graphic only, instead of the whole page?

* Can this problem be reproduced with ConTeXt?  Does ConTeXt
implement transparency in a more robust way?

* If it's not possible to make the PDF file created by TeX more
robust, how can I contact Adobe in order to file a bug report?

It would be nice if transparency can be used together with our company
logo on the same page.  ATM it's not critical because we use
transparency only internally, it's unavoidable when using pgfplots.
ATM we don't ship PDF files containing transparent objects to
customers.  But who knows what we need in the future?

However, as far as I can see this is a general problem.  It doesn't
get noticed in most cases.  Other colors than HKS51 are much less
problematic, hence I assume that all files created by LaTeX suffer
from this problem.

If it's possible to fix this problem or to provide a workaround on the
TeX side, that would be best.  Since PDF is an ISO standard now, I
don't expect that there will be as many new releases of AR as in the
past.  And as Leonard Rosenthol told us, Adobe sorts bug reports by
the number of people who report the same bug.  Since transparency
is supported by very few programs, I suspect that my bug report ends
up at the bottom of the stack.

What I find curious is that AR displays it properly if the logo and
the TikZ stuff appears on different pages.

BTW, thanks to \pdfcompresslevel=0 and \pagestyle{empty} the resulting
PDF file is quite small and readable.

Any ideas?

Regards,
Reinhard

--
----------------------------------------------------------------------------
Reinhard Kotucha                                      Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover                              mailto:reinhard.kotucha at web.de
----------------------------------------------------------------------------
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.
----------------------------------------------------------------------------