% +--------------------------------------------------+
% | Typeset this file to get the documentation.      |
% +--------------------------------------------------+
%
%% Copyright (C) 2015 Javier Bezos
%% All Rights Reserved
%% http://www.tex-tipografia.com
%%
%% This work may be distributed and/or modified under the conditions
%% of the LaTeX Project Public License, either version 1.3 of this
%% license or (at your option) any later version.  The latest version
%% of this license is in
%%     http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2003/12/01 or later.
%%
%% This work has the LPPL maintenance status "maintained".
%%
%% This Current Maintainer of this work is Javier Bezos.
%%
%% This work consists of the files colorspace.tex and colorspace.sty.
\documentclass{article}

\title{\textsf{colorspace}\\\large Version 1.1.0}

 \author{Javier Bezos\\\texttt{http://www.tex-tipografia.com}}
   
\raggedright
\parskip=1ex

\date{2015-06-01}

\begin{document}

\maketitle

This package is built on the previous attempts to provide spot colors
and other additional features by Jens Elstner, Stephan Lehmke and Siep
Kroonenberg (with some inspiration from \textsf{ConTeXt}, too). It
requires \textsf{xcolor}, which is loaded if it has not been before.

It provides a clean user interface, with a single command for defining
a spot color. It seems to work with \textsf{tikz}. Currently only
\textsf{pdftex} and \textsf{luatex} are supported.

Mixing spot colors (with process colors or other spots colors) is
supported to some extent (see below). You can also assign ICC profiles
to the default CMYK, RGB and Gray spaces. Other functions related to
the PDF color spaces (indexed, calibrated, Lab spaces) are not yet
suported, but they are\texttt{} under study. They apply to text and
line art only, not external images. Declarations are global. Using
\verb|\selectcolormodel| does not work yet.

Those docs, like the package itself, are still somewhat tentative (as
you very likely have noticed), but the basic behaviour described here
will be preserved in future versions.

For transparencies, see \textsf{transparent}, by Heiko Oberdiek.

\section{Spot colors}

Write, for example:
\begin{verbatim}
\definespotcolor{foo}{BarTone 555 GN}{.3,.4,.5,.6}
\end{verbatim}

That's all. Here \verb|foo| is the \LaTeX{} name, as used in
\verb|\color| and the like, \verb|BarTone 555 GN| is the PDF name
(multiple spaces are collapsed into one) as shown by PDF readers, and
the four numbers are the CMYK equivalent. \LaTeX{} knows nothing about
the PDF name, which is just a string to be written to the generated
file, while the PDF knows nothing about the \LaTeX{} name.

You can use tints as usual in \textsf{xcolor}, like:
\begin{verbatim}
\color{foo!60}
\colorlet{foo60}{foo!60}
\end{verbatim}
and even set tints from other tints. To mix inks, see below.

The special PDF names \verb|All| (for all plates) and \verb|None| work
as expected:
\begin{verbatim}
\definespotcolor{registration}{All}{1,1,1,1}
\end{verbatim}

Internally, only CMYK is used, but you can define the equivalent color
with another name space, which is then converted:
\begin{verbatim}
\definespotcolor{foo}{BarTone 555 GN}[rgb]{.5, .4, .3}
\end{verbatim}

To change the color space for a page and the subsequent ones, you can
set something like:
\begin{verbatim}
\pagecolorspace{name1,name2,name3}
\end{verbatim}
(It can be empty.) To return to the default color space, which
contains all the defined spot colors, use \verb|\resetpagecolorspace|.
Use this macro with care, because of the asynchronous nature of \TeX{}
-- remember it affects the whole current page.

\section{Mixing spot colors}

To mix spot colors you must first declare a color space (or model)
including them. This is done with something like:
\begin{verbatim}
\definecolorspace{name}{mixed}{color1,color2,color3}
\end{verbatim}
(The second argument is the type of color space.)  For example, if we
have two spot colors named \verb|spot1| and \verb|spot2|, and we want
in addition yellow:
\begin{verbatim}
\definecolorspace{spot12y}{mixed}{spot1,spot2,yellow}
\end{verbatim}
A typical usage, for shades, would be:
\begin{verbatim}
\definecolorspace{shaded1}{mixed}{spot1,black}
\end{verbatim}

Due to internal limitations of \textsf{xcolor}, no more than four
colors are allowed. The alternate color space in the PDF file is that
of the spot colors (which means currently it is CMYK).

Then, you can define a color with:
\begin{verbatim}
\definecolor{mix12y}{spot12y}{.5,.4,.6}
\definecolor{sh1}{shaded1}{.6,.3}
\end{verbatim}
or set it with
\begin{verbatim}
\color[spot12y]{.5,.4,.3}
\color[shaded1]{.6,.3}
\end{verbatim}
As in spot colors, the only operation allowed is \verb|!| for tints
(ie, \verb|color!num|). But there is an easy trick to mix colors with
\verb|!| and \verb|color,num| -- just define an ortogonal set of
colors based on the new color model:
\begin{verbatim}
\definecolor{xspot1}{spot12y}{1,0,0}
\definecolor{xspot2}{spot12y}{0,1,0}
\definecolor{xyellow}{spot12y}{0,0,1}
\end{verbatim}
and then you can say:
\begin{verbatim}
\color{xspot1!30!xspot2!40!xyellow}
\color{spot12y:xspot1,3;xspot2,2;xyellow,1}
\end{verbatim}
Of course, it is just a trick and a better and direct interface is
under study.

Color series are also partially supported. For example:
\begin{verbatim}
\definecolorseries{test}{spot12y}{grad}[spot12y]{.95,.85,.55}{3,11,17}
\definecolorseries{test}{spot12y}{last}{xyellow!50}{xspotA}
\end{verbatim}

(The key is not to mix the new model with other color models.)

\section{ICC Based spaces}

The starred version \verb|\definecolorspace*| does not define a new
color model, but sets the behaviour of the three basic color spaces
(\verb|cmyk|, \verb|rgb| and \verb|gray|).  When belonging to the same
space, the last one for that space takes precedence. It cannot be used
to define new colors or set them. Currently, only a type is supported --
\verb|iccbased|.  For example,
\begin{verbatim}
\definecolorspace*{sRGB}{iccbased}{sRGB Profile.icc}
\end{verbatim}

The space it applies to is read from the ICC profile.  The name can be
used in \verb|\pagecolorspace| (and must, if you want it to be
active). Alternatively, there are 3 reserved names: \verb|*rgb|,
\verb|*gray|, \verb|*cmyk|, which stand for the current default
spaces. The former are not set by \verb|\resetpagecolorspace|, but the
starred named are.

Note those ICC spaces does not go to the output intent dictionary (see
the \textsf{pdfx} package). The latter, as the PDF reference explains,
supplements rather than replaces the ICC profiles in a default color
space.

\section{Overprinting}

This is usually a pre-print task, but by setting it in the document you
will get a better idea of how the colors are actually
overlapped. However, remember the effect produced is device-dependent,
and colorant overprint decisions should be made at output time
(according to the PDF reference).

Very often, it is set for the whole document with the package options
\verb|knockout| (no overprint), and \verb|overprint|. By default, the
overprint mode is 1, but it can be changed with \verb|opm=0|.

Once set the overprint state for the whole document, you can use
something like:
\begin{verbatim}
{\overprintstate{1}text}
\textoverprint[1]{text}
\end{verbatim}
(or \verb|0|, or \verb|no|; default in \verb|\textoverprint| is
\verb|1|, except with the package option \verb|opm=0|).

Since the color stack is used, pdf\TeX{} $\ge$ 1.40 is required.

\end{document}







