From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- macros/latex/contrib/colorspace/README.md | 38 ++ macros/latex/contrib/colorspace/colorspace.pdf | Bin 0 -> 99243 bytes macros/latex/contrib/colorspace/colorspace.sty | 614 +++++++++++++++++++++ macros/latex/contrib/colorspace/colorspace.tex | 563 +++++++++++++++++++ .../latex/contrib/colorspace/colorspaceshade.png | Bin 0 -> 15861 bytes 5 files changed, 1215 insertions(+) create mode 100644 macros/latex/contrib/colorspace/README.md create mode 100644 macros/latex/contrib/colorspace/colorspace.pdf create mode 100644 macros/latex/contrib/colorspace/colorspace.sty create mode 100644 macros/latex/contrib/colorspace/colorspace.tex create mode 100644 macros/latex/contrib/colorspace/colorspaceshade.png (limited to 'macros/latex/contrib/colorspace') diff --git a/macros/latex/contrib/colorspace/README.md b/macros/latex/contrib/colorspace/README.md new file mode 100644 index 0000000000..c3d2a17ce1 --- /dev/null +++ b/macros/latex/contrib/colorspace/README.md @@ -0,0 +1,38 @@ +## colorspace + +This package provides some tools related to PDF color spaces and color +management. It requires xcolor, which is loaded if it has not been +before. + +Currently it supports what I think are the most common tools: + +* Spot colors (CMYK and CIE LAB) +* Mixed spot and process colors (up to 4) +* ICC based default CMYK, RGB and Gray spaces +* Overprinting + +Currently only pdftex and luatex are supported. It seems to work with tikz. + +For example, to define a spot color, just say something like: + +\definespotcolor{foo}{BarTone 555 GN}{.3, .4, .5, .6} + +That's all. + +### Latest changes + +``` +* 1.3 Fixes several incompatibilities with pgf/tikz +* 1.2.0 CIE LAB spot colors (including mixed inks with a + CMYK alternative) +* 1.1.1 is compatible with luatex 0.95 +``` + +License: MIT + +Repository: https://github.com/jbezos/colorspace + +________ +Javier Bezos --- http://www.texnia.com + +2019-03-25 \ No newline at end of file diff --git a/macros/latex/contrib/colorspace/colorspace.pdf b/macros/latex/contrib/colorspace/colorspace.pdf new file mode 100644 index 0000000000..a67b69fc82 Binary files /dev/null and b/macros/latex/contrib/colorspace/colorspace.pdf differ diff --git a/macros/latex/contrib/colorspace/colorspace.sty b/macros/latex/contrib/colorspace/colorspace.sty new file mode 100644 index 0000000000..40e2948f3b --- /dev/null +++ b/macros/latex/contrib/colorspace/colorspace.sty @@ -0,0 +1,614 @@ +% +% Copyright (C) 2015-2019 Javier Bezos http://www.texnia.com +% +% This file may be distributed and/or modified under the conditions of +% the MIT License. A version can be found at the end of this file. +% +% Repository: https://github.com/jbezos/colorspace +% + +\ProvidesPackage{colorspace}[2019/03/25 v1.3 PDF color spaces] + +\edef\spc@savedcatcodes{% + \catcode`\noexpand\/=\the\catcode`\/ + \catcode`\noexpand\&=\the\catcode`\& % & is 'other' here! + \catcode`\noexpand\<=\the\catcode`\< + \catcode`\noexpand\>=\the\catcode`\>} +\catcode`\/=12 +\catcode`\>=12 +\catcode`\<=12 +\catcode`\&=11 % we use it in macro names + +% pdftex vs luatex compatibility + +\ifx\pdfextension\@undefined + \let\spc@Pageresources\pdfpageresources + \let\spc@Obj\pdfobj + \let\spc@Lastobj\pdflastobj + \let\spc@Colorstack\pdfcolorstack + \let\spc@Colorstackinit\pdfcolorstackinit +\else + \edef\spc@Pageresources{\pdfvariable pageresources} + \protected\def\spc@Obj{\pdfextension obj } + \protected\def\spc@Lastobj{\numexpr\pdffeedback lastobj\relax} + \protected\def\spc@Colorstack{\pdfextension colorstack} + \def\spc@Colorstackinit{\pdffeedback colorstackinit} +\fi + +\def\spc@unknown#1#2{% + \@ifundefined{#1}% + {\PackageError{colorspace}{Unknown #2}% + {You haven't defined it or perhaps you misspelled it.}}% + {}} + +\@ifundefined{XC@sdef}{\RequirePackage{xcolor}}{} + +\long\def\spc@afterfi#1\fi{\fi#1} +% Trim spaces in strings and normalize to single spaces +\def\spc@spaces#1 #2{% + #1\ifx\@empty#2\else\spc@afterfi\spc@spaces@i{#1}#2\fi} +\def\spc@spaces@i#1{% + \ifx\\#1\\\else\space\fi\spc@spaces} +\def\spc@dospaces#1{% + \edef#1{#1\space}% + \edef#1{\expandafter\spc@spaces#1\@empty}} + +% Define a pseudo-model for spot colors. We need define the following +% 3 macros: + +\XC@sdef\XC@mod@&spot{&spot} +\def\color@&spot#1#2{% + \ifx\spc@ir\@undefined + \expandafter\spc@getref\current@color\@@ + \fi + \c@lor@arg{#2}% + \edef#1{\spc@ir\space cs \spc@ir\space CS #2 sc #2 SC}} +\def\XC@clr@&spot@white{0} + +% A somewhat dirty hack for converting cmyk to spot. The internal +% format is {}{/&Color cs /&Color CS n sc n SC}{spot}{n}, where n=1 is +% a tint of 100%. The original CMYK values are stored in +% \spc@ascmyk@. + +\def\spc@cmyktospot#1#2{% + \begingroup + \def\spc@tempc##1 ##2 ##3 ##4 k##5\@@{##1 ##2 ##3 ##4}% + \def\xcolor@##1##2##3##4{% + \expandafter\protected@xdef\csname\string\color@#1\endcsname{% + \noexpand\xcolor@{##1}{/ cs / CS 1 sc 1 SC}{&spot}{1}}% + \xdef\spc@tempa{\spc@tempc##2\@@}% + \expandafter\xdef\csname spc@ascmyk@#1\endcsname{##4}}% + \csname\string\color@#1\endcsname + \endgroup} + +% The internal PDF name (which is like the public one with a & +% prepended) is available in the first argument of \xcolor@. The +% following macros extract it. + +\def\spc@getir#1{% + \begingroup + \def\xcolor@##1##2##3##4{\spc@getref##2\@@}% + \@nameuse{#1}% + \endgroup} +\def\spc@getref#1 #2\@@{\gdef\spc@ir{#1}} + +% We need to redefine an xcolor macro for the tint operator ! to be +% recognized. It's done in a more modular way than xcolor: + +\def\spc@infl@cmyk{\let\spc@inflcommas\@empty}% 4 values=4-4 commas +\def\spc@infl@gray{\def\spc@inflcommas{,,,}}% 1 value=4-1 commas +\def\spc@infl@&spot{% + \spc@getir{\string\color@\@@nam}% + \def\spc@inflcommas{,,,}}% + +\def\XC@inflate#1#2#3#4{% + \def\spc@inflcommas{,}% Assume 3 values=4-3 commas + \@nameuse{spc@infl@\@@mod}% + \edef#4{#2,\spc@inflcommas#3\spc@inflcommas}} + +% The following macro stores all spot colors, with the LaTeX name. It +% also stores other color spaces. Internally is an \spc@elt list. + +\let\spc@csall\@empty + +% Now the main command for defining spot colors. \spc@ir@ +% contains {/&Spot X 0 R} + +\newcommand\definespotcolor[2]{\protected@edef\spc@tempa{{#1}{#2}}\spc@defsc} +\newcommand\spc@defsc[2][cmyk]{\expandafter\spc@defsc@i\spc@tempa{#1}{#2}} + +\def\spc@splitbar#1#2#3/#4\@nil{% + \def#1{#3}% + \def#2{#4}} + +\let\spc@lab@values\relax + +\@namedef{spc@opt@alt=lab}#1{% + \@expandtwoargs\in@{/}{#1}% + \ifin@ + \spc@splitbar\spc@lab@values\spc@the@cmyk#1\@nil + \else + \def\spc@lab@values{#1}% + \def\spc@the@cmyk{0,0,0,0}% dummy + \fi + \def\spc@tempd##1,{% comma -> space + \ifx\@empty##1\else##1 \expandafter\spc@tempd\fi}% + \edef\spc@lab@values{\expandafter\spc@tempd\spc@lab@values,\@empty,}} + +\def\spc@defsc@i#1#2#3#4{% + \def\spc@tempc##1 ##2{% Converts spaces to #20 + ##1% + \ifx\@empty##2\else + \ifx\\##1\\\string####20\else\string####20\fi + \spc@afterfi\spc@tempc##2% + \fi}% + \edef\spc@tempb{\spc@tempc#2 \@empty}% Apply to convert + \def\spc@elt##1##2{% + \@expandtwoargs\in@{/&\spc@tempb\space}{\@nameuse{spc@ir@##2}}% + \ifin@ + \PackageError{colorspace}{Duplicated spot name `#2'}% + {This spot name was taken by `##2'.}% + \fi} + \spc@csall + \@ifundefined{spc@opt@\zap@space#3 \@empty}% + {\definecolor{#1}{cmyk:#3}{#4}}% + {\@nameuse{spc@opt@\zap@space#3 \@empty}{#4}% + \definecolor{#1}{cmyk}{\spc@the@cmyk}}% + \expandafter\spc@cmyktospot{#1}\spc@tempb % Convert cmyk > spot + \ifx\spc@lab@values\relax + \immediate\spc@Obj{[ /Separation /\spc@tempb\space + /DeviceCMYK << /FunctionType 2 /Domain [0 1] + /C0 [0 0 0 0] /C1 [\spc@tempa] /N 1 >> ]}% pdf separation + \else + \immediate\spc@Obj{[ /Separation /\spc@tempb\space + \spc@illum@ref << /FunctionType 2 /Domain [0 1] + /Range[0 100 -128 127 -128 127] + /C0 [100 0 0] /C1 [\spc@lab@values] /N 1 >> ]}% pdf separation + \global\let\spc@lab@values\relax + \fi + \expandafter\xdef\csname spc@ir@#1\endcsname{% + /&\spc@tempb\space\the\spc@Lastobj\space 0 R}% save ref to obj + \let\spc@elt\relax + \xdef\spc@csall{\spc@csall\spc@elt2{#1}}} + +% The pgf stuff *must* go before \resetpagecolorspace +\AtBeginDocument{% + \ifx\spc@csall\@empty\else % ie, if spot/iccbased colors only + \ifx\pgf@sys@pgf@resource@list@colorspaces\@undefined\else + \def\spc@everycs{\pgf@sys@pgf@resource@list@colorspaces}% + \edef\spc@tempa{% Remove pgf "static" ColorSpace + \noexpand\spc@remcs\the\spc@Pageresources + \noexpand\spc@remcs{\pgf@sys@pdf@colrospaces@objnum}}% + \spc@tempa + \fi + \resetpagecolorspace + \fi} + +% Options for illuminants: + +\def\spc@illum@obj#1{% + \immediate\spc@Obj{[ /Lab + << /WhitePoint [#1] /Range [-128 127 -128 127] >> ]}% + \xdef\spc@illum@ref{\the\spc@Lastobj\space 0 R }} + +% 1931, 2-degree observer. c is deprecated + +\DeclareOption{illuminant=a}{\spc@illum@obj{1.0985 1 0.3558}} +\DeclareOption{illuminant=c}{\spc@illum@obj{0.9807 1 1.1822}} +\DeclareOption{illuminant=e}{\spc@illum@obj{1 1 1}} +\DeclareOption{illuminant=d50}{\spc@illum@obj{0.9642 1 0.8251}} +\DeclareOption{illuminant=d55}{\spc@illum@obj{0.9568 1 0.9214}} +\DeclareOption{illuminant=d65}{\spc@illum@obj{0.9504 1 1.0888}} +\DeclareOption{illuminant=d75}{\spc@illum@obj{0.9497 1 1.2261}} + +% Page color spaces. The arrays mapping the spot colors to the obj +% refs are saved into the pdf as objects, and then we also save its +% reference for later recovery. Well, \pdfpageresources is not +% exactly "programmer"-friendy. We add the /ColorSpace, but if we +% switch from a previoss one, the latter must be removed, too. This +% is what \spc@remcs does. We also make sure a color space is +% defined once: first we rebuild the argument without spaces and +% then form the macro name using the order in csall, which is +% fixed. The macro name is built with the PDF names. + +\let\spc@currcs\@empty +\let\spc@cs@\@empty + +\let\spc@everycs\@empty + +\newcommand\pagecolorspace[1]{% + \protected@edef\spc@tempa{{#1}}% + \expandafter\spc@pagecs\spc@tempa} + +\def\spc@pagecs#1{% + \ifx\spc@currcs\@empty\else + \edef\spc@tempa{% + \noexpand\spc@remcs\the\spc@Pageresources + \noexpand\spc@remcs{\spc@currcs}}% + \spc@tempa + \fi + \let\spc@tempd\@empty % list with known spaces + \@for\spc@tempa:=#1\do{% + \ifx\spc@tempa\@empty\else + \spc@dospaces\spc@tempa + \spc@unknown{spc@ir@\spc@tempa}{color (space) `\spc@tempa'}% + \edef\spc@tempd{,\spc@tempd,\spc@tempa,}% + \fi}% + \let\spc@tempb\@empty % elements in /ColorSpace + \let\spc@tempc\@empty % name for macro (\..&..&) with pdf ref + \def\spc@elt##1##2{% + \@expandtwoargs\in@{,##2,}{\spc@tempd}% + \ifin@ + \protected@edef\spc@tempb{% + \spc@tempb\@nameuse{spc@ir@##2}\space}% + \protected@edef\spc@tempc{% + \spc@tempc\@nameuse{spc@ir@##2}&}% + \fi}% + \spc@csall % Uses \spc@elt + \@ifundefined{spc@cs@\spc@tempc}% + {\immediate\spc@Obj{<< \spc@everycs\space\spc@tempb>>}% + \expandafter\xdef\csname spc@cs@\spc@tempc\endcsname{\the\spc@Lastobj}}% + {}% + \expandafter\let\expandafter\spc@currcs\csname spc@cs@\spc@tempc\endcsname + \ifx\spc@currcs\@empty\else + \edef\spc@tempa{\spc@Pageresources{% + \the\spc@Pageresources\space/ColorSpace \@nameuse{spc@cs@\spc@tempc} 0 R}}% + \spc@tempa + \fi} + +\newcommand\resetpagecolorspace{% + \def\spc@elt##1##2{\ifnum##1>1 ##2,\fi}% + \edef\spc@tempa{{\spc@csall}}% + \expandafter\pagecolorspace\spc@tempa} + +\def\spc@remcs#1\spc@remcs#2{% + \def\spc@tempc##1 /ColorSpace #2 ##2 R##3\spc@tempc{% + \spc@Pageresources{##1##3}}% + \spc@tempc#1\spc@tempc} + +% Support for pgf (I hope--) + +\def\pgfsys@color@&spot@stroke#1{% + \spc@getir{\string\color@pgfstrokecolor}% + \pgfsysprotocol@literal{\spc@ir\space CS}% + \pgfsysprotocol@literal{#1 SC}} +\def\pgfsys@color@&spot@fill#1{% + \spc@getir{\string\color@pgffillcolor}% + \pgfsysprotocol@literal{\spc@ir\space cs}% + \pgfsysprotocol@literal{#1 sc}} +\def\pgfsys@color@&spot#1{% + \pgfsys@color@&spot@stroke{#1}% + \pgfsys@color@&spot@fill{#1}} + +% ==== Mixed colors ==== + +% xspace assumes color models have 1, 3 or 4 components. We need +% modify a couple of macros, but we'll do it only if a 2-component +% space is defined: + +\def\spc@twocomps{% + \let\spc@twocomps\relax + \gdef\XC@vec##1,##2,##3,##4,##5,##6,##7,##8,##9{% + \def\@@tmp{}% + \XC@vec@{##1}{##5}% + \ifx,##2,\else\XC@vec@{##2}{##6}% + \ifx,##3,\else\XC@vec@{##3}{##7}% + \ifx,##4,\else\XC@vec@{##4}{##8}% + \fi\fi\fi + \aftergroupdef##9\@@tmp}% + \gdef\XC@calc@##1,##2,##3,##4,##5:##6{% + \XC@let@Nc\@@cmd{XC@calc##6}% + \@@cmd{##1}\@@tmp + \ifx,##2,% + \else\@@cmd{##2}\@tempa + \ifx,##3,\edef\@@tmp{\@@tmp,\@tempa}% + \else\@@cmd{##3}\@tempb + \ifx,##4,\edef\@@tmp{\@@tmp,\@tempa,\@tempb}% + \else\@@cmd{##4}\@tempc\edef\@@tmp{\@@tmp,\@tempa,\@tempb,\@tempc}% + \fi\fi\fi}} + +% The following macros define models with 1 to 4 components. It's +% written with the "copypaste" pattern, so it should be +% improved. Here, the limitations of xcolor become aparent, because +% 5 components would require "-1" commas. + +\def\spc@mix@i#1#2{% + \expandafter\XC@sdef\csname XC@mod@#1\endcsname{#1}% + \@namedef{color@#1}##1##2{\@nameuse{c@lor@@#1}##2\@@##1}% + \@namedef{c@lor@@#1}##1\@@##2{% + \c@lor@arg{##1}% + \edef##2{#2 cs #2 CS ##1 scn ##1 SCN}}% + \@namedef{XC@clr@#1@white}{0}% + \@namedef{spc@infl@#1}{\def\spc@inflcommas{,,,}}} % 1 value = 4 - 1 commas + +\def\spc@mix@ii#1#2{% + \expandafter\XC@sdef\csname XC@mod@#1\endcsname{#1}% + \@namedef{color@#1}##1##2{\@nameuse{c@lor@@#1}##2\@@##1}% + \@namedef{c@lor@@#1}##1,##2\@@##3{% + \c@lor@arg{##1}% + \c@lor@arg{##2}% + \edef##3{#2 cs #2 CS ##1 ##2 scn ##1 ##2 SCN}}% + \@namedef{XC@clr@#1@white}{0,0}% + \@namedef{spc@infl@#1}{\def\spc@inflcommas{,,}}} % 2 values = 4 - 2 commas + +\def\spc@mix@iii#1#2{% + \expandafter\XC@sdef\csname XC@mod@#1\endcsname{#1}% + \@namedef{color@#1}##1##2{\@nameuse{c@lor@@#1}##2\@@##1}% + \@namedef{c@lor@@#1}##1,##2,##3\@@##4{% + \c@lor@arg{##1}% + \c@lor@arg{##2}% + \c@lor@arg{##3}% + \edef##4{#2 cs #2 CS ##1 ##2 ##3 scn ##1 ##2 ##3 SCN}}% + \@namedef{XC@clr@#1@white}{0,0,0}% + \@namedef{spc@infl@#1}{\def\spc@inflcommas{,}}} % 3 values = 4 - 1 commas + +\def\spc@mix@iv#1#2{% + \expandafter\XC@sdef\csname XC@mod@#1\endcsname{#1}% + \@namedef{color@#1}##1##2{\@nameuse{c@lor@@#1}##2\@@##1}% + \@namedef{c@lor@@#1}##1,##2,##3,##4\@@##5{% + \c@lor@arg{##1}% + \c@lor@arg{##2}% + \c@lor@arg{##3}% + \c@lor@arg{##4}% + \edef##5{#2 cs #2 CS ##1 ##2 ##3 ##4 scn ##1 ##2 ##3 ##4 SCN}}% + \@namedef{XC@clr@#1@white}{0,0,0,0}% + \@namedef{spc@infl@#1}{\let\spc@inflcommas\@empty}} % 4 value = 4 - + % 0 commas + +% A few auxliary macros: + +\def\spc@nl{^^J} + +\def\spc@getirbase/ #2\@@{#1} +\def\spc@getirbaseC/ #2\@@{#1 #2} + +\def\spc@writecomp#1#2{% + \advance\@tempcntb\@ne + \edef#1{#1 + \the\numexpr\@tempcntb-\@tempcnta\relax\space + index -#2\space mul 1.0 add mul\spc@nl}} + +\def\spc@writecmykcomps#1,#2,#3,#4\@@{% + \spc@writecomp\spc@@cyan{#1}% + \spc@writecomp\spc@@magenta{#2}% + \spc@writecomp\spc@@yellow{#3}% + \spc@writecomp\spc@@black{#4}} + +% And the main macro: + +\newif\ifspc@dflt + +\newcommand\definecolorspace{% + \@ifstar + {\spc@dflttrue\spc@defcs}% + {\spc@dfltfalse\spc@defcs}} + +\@onlypreamble\definecolorspace + +\def\spc@defcs#1#2#3{% + \@ifundefined{spc@defcs@#2}% + {\spc@unknown{spc@defcs@#2}{color space type `#2'}}% + {\protected@edef\spc@tempa{% + \expandafter\noexpand\csname spc@defcs@#2\endcsname + {#1}{#3}}% + \spc@tempa}} + +\def\spc@defcs@mixed#1#2{% + \ifspc@dflt + \PackageError{colorspace}{Unsupported}% + {`mixed' only works with the unstarred command}% + \fi + \begingroup + % the process part of the tint transform: + \def\spc@@Pcyan{1.0\spc@nl}\def\spc@@Pmagenta{1.0\spc@nl}% + \def\spc@@Pyellow{1.0\spc@nl}\def\spc@@Pblack{1.0\spc@nl}% + % the spot part: + \let\spc@@cyan\@empty\let\spc@@magenta\@empty + \let\spc@@yellow\@empty\let\spc@@black\@empty + % position on stack + \edef\spc@@poscyan{0}\edef\spc@@posmagenta{1}% + \edef\spc@@posyellow{2}\edef\spc@@posblack{3}% + \@tempcntb\z@ % Number of colors + \let\spc@pdfdoms\@empty % stores /Domain + \let\spc@@pops\@empty + \@for\spc@tempa:=#2\do{% + \advance\@tempcntb\@ne % Count colors + \edef\spc@@pops{\spc@@pops\space pop}% + \edef\spc@pdfdoms{\spc@pdfdoms0 1 }}% + \ifcase\@tempcntb\or1\or\spc@twocomps\or\or\else + \PackageError{colorspace}{Too many inks}% + {Currently, only up to 4 components are supported}% + \fi + \@tempcnta\z@ % position on stack + \let\spc@pdfdevn\@empty % stores names for /DeviceN + \let\spc@pdfclrnts\@empty % stores /Colorants + \let\spc@name\@empty % stores name for page /ColorSpace + \def\spc@ir@cyan{Cyan}\def\spc@ir@magenta{Magenta}% + \def\spc@ir@yellow{Yellow}\def\spc@ir@black{Black}% + \@for\spc@tempa:=#2\do{% + \spc@dospaces\spc@tempa + \advance\@tempcnta\@ne + \edef\spc@ir{\csname spc@ir@\spc@tempa\endcsname}% + \@expandtwoargs\in@{,\spc@tempa,}{,cyan,magenta,yellow,black,}% + \ifin@ + \edef\spc@pdfdevn{\spc@pdfdevn\space/\spc@ir}% + \edef\spc@name{\spc@name &\spc@ir}% + \expandafter + \edef\csname spc@@P\spc@tempa\endcsname{% + \the\numexpr\@tempcntb+\@nameuse{spc@@pos\spc@tempa}% + -\@tempcnta\relax\space + index neg 1.0 add\spc@nl}% ========== + \else + \@ifundefined{spc@ascmyk@\spc@tempa}% + {\spc@unknown{spc@ascmyk@\spc@tempa}{spot color + `\spc@tempa'}}% + {}% + \edef\spc@pdfdevn{\spc@pdfdevn\space + /\expandafter\spc@getirbase\spc@ir\@@}% + \edef\spc@pdfclrnts{\spc@pdfclrnts\space + /\expandafter\spc@getirbaseC\spc@ir\@@}% + \edef\spc@name{\spc@name + &\expandafter\spc@getirbase\spc@ir\@@}% + \expandafter\expandafter\expandafter\spc@writecmykcomps + \csname spc@ascmyk@\spc@tempa\endcsname\@@ + \advance\@tempcntb-4\relax + \fi}% + \immediate\spc@Obj stream attr + {/FunctionType 4 + /Domain [ \spc@pdfdoms] + /Range [ 0 1 0 1 0 1 0 1 ]}% + {\string{\space + \spc@@Pcyan\spc@@cyan neg 1.0 add\spc@nl + \spc@@Pmagenta\spc@@magenta neg 1.0 add\spc@nl + \spc@@Pyellow\spc@@yellow neg 1.0 add\spc@nl + \spc@@Pblack\spc@@black neg 1.0 add\spc@nl + \the\numexpr4+\@tempcntb\relax\space 4 roll\spc@@pops + \space\string}}% + \immediate\spc@Obj{[ /DeviceN [\spc@pdfdevn\space] /DeviceCMYK + \the\spc@Lastobj\space0 R + << /Colorants <<\spc@pdfclrnts\space >> >> ]}% + \expandafter\xdef\csname spc@ir@#1\endcsname{% + /\spc@name\space\the\spc@Lastobj\space 0 R}% save ref to obj + \let\spc@elt\relax + \xdef\spc@csall{\spc@csall\spc@elt2{#1}}% + \xdef\spc@tempa{% + \expandafter\noexpand + \csname spc@mix@\romannumeral\@tempcntb\endcsname + {#1}{/\spc@name}}% + \endgroup + \spc@tempa} + +% === ICC based default spaces === + +% luatex removed pdffiledump, so we use lua code. + +\def\spc@defcs@iccbased#1#2{% + \ifspc@dflt\else + \PackageError{colorspace}{Unsupported}% + {`iccbased' only works with the starred command}% + \fi + \begingroup + % hex equivalents (which is the filedump format) and literal + % (which is the lua format) + \@namedef{spc@@47524159}{0}\@namedef{spc@@GRAY}{0}% + \@namedef{spc@@52474220}{1}\@namedef{spc@@RGB }{1}% + \@namedef{spc@@434D594B}{2}\@namedef{spc@@CMYK}{2}% + \def\spc@@space{\ifcase\spc@tempa Gray\or RGB\or CMYK\fi}% + \def\spc@@spacelc{\ifcase\spc@tempa gray\or rgb\or cmyk\fi}% + % read the icc file and extract the space it applies to + \ifx\pdffiledump\@undefined + \directlua{ + local icc = io.open([[#2]], "r") + if icc then + icc:seek("set", 16) + tex.print([[\noexpand\csname @namedef\endcsname{spc@tempa}{]] + .. icc:read(4) .. [[}]]) + end}% + \else + \edef\spc@tempa{\pdffiledump offset 16 length 4 {#2}}% + \fi + \@ifundefined{spc@@\spc@tempa}% + {\PackageError{colorspace}{Unsupported ICC space}% + {Currently, only Gray, RGB and CMYK are supported}}% + {\edef\spc@tempa{\@nameuse{spc@@\spc@tempa}}}% + \immediate\spc@Obj + stream attr {\ifcase\spc@tempa + /N 1 /Alternate /DeviceGray\or + /N 3 /Alternate /DeviceRGB\or + /N 4 /Alternate /DeviceCMYK\fi}% + file {#2}% + \immediate\spc@Obj{[ /ICCBased \the\spc@Lastobj\space 0 R ]}% + % to the default color list, add an intermediate name * + % (only once) containing the last setting (add also the + % actual name with flag 1 instead of 2) + \let\spc@elt\relax + \@ifundefined{spc@ir@*\spc@@spacelc}% + {\xdef\spc@csall{\spc@csall\spc@elt2{*\spc@@spacelc}}}% + {} % -- do nothing + \expandafter\xdef\csname spc@ir@*\spc@@spacelc\endcsname{% + /Default\spc@@space\space\the\spc@Lastobj\space 0 R}% + \xdef\spc@csall{\spc@csall\spc@elt1{#1}}% + \expandafter\xdef\csname spc@ir@#1\endcsname{% + /Default\spc@@space\space\the\spc@Lastobj\space 0 R}% + \endgroup} + +% ==== Overprint/Knokout ==== + +\DeclareOption{overprint}{\def\spc@op{1}} +\DeclareOption{opm=0}{\def\spc@op{0}\def\spc@opm{0}} +\DeclareOption{opm=1}{} +\DeclareOption{knockout}{\def\spc@op{2}} % After opm! +\def\spc@opm{1} +\ProcessOptions\relax + +\ifx\spc@op\@undefined + \spc@savedcatcodes +\endinput\fi % One line! + +\def\spc@op@no{2} +\@namedef{spc@op@1}{1} +\@namedef{spc@op@0}{0} + +\newcommand\overprintstate[1]{% + \spc@unknown{spc@op@#1}{overprint state `#1'}% + \ifnum\csname spc@op@#1\endcsname=\spc@op\else + \expandafter\let\expandafter\spc@op\csname spc@op@#1\endcsname + \spc@setop + \fi} + +\newcommand\textoverprint[2][\spc@opm]{{\overprintstate{#1}#2}} + +\immediate\spc@Obj{<< /Type /ExtGState /op false /OP false >>}% +\edef\spc@tempa{/SPCko \the\spc@Lastobj\space 0 R }% +\immediate\spc@Obj{<< /Type /ExtGState /op true /OP true /OPM 0 >>}% +\edef\spc@tempa{\spc@tempa/SPCmz \the\spc@Lastobj\space 0 R }% +\immediate\spc@Obj{<< /Type /ExtGState /op true /OP true /OPM 1 >>}% +\edef\spc@tempa{\spc@tempa/SPCop \the\spc@Lastobj\space 0 R }% +\immediate\spc@Obj{<< \spc@tempa>>}% +\edef\spc@op@saveobj{\the\spc@Lastobj} + +\AtBeginDocument{% + \edef\spc@tempa{\global\spc@Pageresources{\the\spc@Pageresources + \space /ExtGState \spc@op@saveobj\space 0 R }}% + \spc@tempa} + +\def\spc@setop{% + \spc@Colorstack\spc@opstack push{\spc@getop}% + \aftergroup\spc@resetop} +\def\spc@resetop{\spc@Colorstack\spc@opstack pop\relax} +\def\spc@getop{% + \ifcase\spc@op + /SPCmz gs + \or + /SPCop gs + \or + /SPCko gs + \fi} + +\chardef\spc@opstack\spc@Colorstackinit page direct{\spc@getop} + +\spc@savedcatcodes + +\endinput + +MIT License +----------- + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/macros/latex/contrib/colorspace/colorspace.tex b/macros/latex/contrib/colorspace/colorspace.tex new file mode 100644 index 0000000000..dff859ab3e --- /dev/null +++ b/macros/latex/contrib/colorspace/colorspace.tex @@ -0,0 +1,563 @@ +% +% Copyright (C) 2015-2019 Javier Bezos http://www.texnia.com +% +% This file may be distributed and/or modified under the conditions of +% the MIT License. A version can be found at the end of this file. +% +% Repository: https://github.com/jbezos/colorspace +% + +\documentclass[a4paper]{ltxguide} + +\title{\textsf{colorspace}\\\large Version 1.3} + +\author{Javier Bezos\\\texttt{http://www.texnia.com}} + +\date{2019-03-25} + +\raggedright +\parskip=.8ex +\advance\oddsidemargin-.7cm +\advance\textwidth2cm +\addtolength{\textheight}{3.5cm} +\addtolength{\topmargin}{-2cm} + +\newif\ifcolorspace +\newif\iftikz + +\usepackage{graphicx,bera} + +\IfFileExists{colorspace.sty}{% + \usepackage[illuminant=d65]{colorspace}% + \definespotcolor{foo}{BarTone 555 GN}{.8,.2,.5,.3}% + \definespotcolor{foob}{BarTone 666 GN}[rgb]{.8, .2, .4}% + \definespotcolor{foolab}{BarTone 888 LB}[alt=lab]% + {50, -30, -40/1, .20, .15, .07}% +% + \definecolorspace{fooshaded}{mixed}{foo,black}% + \definecolorspace{labshaded}{mixed}{foolab,foob}% +% + \definecolor{sfoo}{fooshaded}{1,0} + \definecolor{sblack}{fooshaded}{0,1} + \definecolorseries{shseries}{fooshaded}{last}{sfoo!40}{sblack} + \colorspacetrue}{} + +\IfFileExists{tikz.sty}{% + \catcode`|=12 + \usepackage{tikz}% + \catcode`|=\active + \tikztrue}{} + +\def\showclr#1#{\testclr{#1}} +\def\testclr#1#2{{\fboxsep0pt\fbox{\colorbox#1{#2}{\phantom{,MM}}}}} + +\makeatletter +\def\@begintheorem#1#2{% + \list{}{}% + \global\advance\@listdepth\m@ne + \item[{\sffamily\bfseries\color{foob}\MakeUppercase{#1}}]}% +\makeatother +\newtheorem{warning}{Warning} +\newtheorem{note}{Note} +\newtheorem{example}{Example} + +\begin{document} + +{\fontsize{48}{48}\selectfont colorspace\par} +{\LARGE Spot colors, mixed inks and more\par} +\vspace*{1ex} +Version 1.3 (2019-03-25)\par +Javier Bezos (\texttt{http://www.texnia.com}) + +\vspace*{6ex} + +The aim of this package is, as its name implies, to provide tools for +PDF color spaces. It requires \textsf{xcolor}, which is loaded if it +has not been before. It seems to work with \textsf{tikz}. + +Currently it supports what I think are the most common tools: +\begin{itemize} +\item Spot colors, with a clean user interface, and including tints + (with the |!| notation). +\item CIE LAB spot colors. +\item Proper switching of color spaces. +\item Mixed spot and process colors (up to 4), like shades (ie, a spot + color with black). Also CIE LAB if a CMYK equivalent is provided. +\item ICC based (or ``tagged'') default CMYK, RGB and Gray spaces. +\item Overprinting (across pages, using the color stack). +\end{itemize} +Currently only \textsf{pdftex} and \textsf{luatex} are +supported. Support for \textsf{xetex} is on the `to do' list, but due +to the limitations of this engine this task is somewhat challenging +and I'm not sure all features will be implemented. + +Other functions related to the PDF color spaces (indexed, calibrated, +Lab spaces) are not yet suported, but they are under study. Calibrated +colors, although not directly supported, can be defined with an ICC +profile created with +LPROF\footnote{\texttt{http://lprof.sourceforge.net/}} and then +assigned to a default space as described below. + +They apply to text and line art only, not external images. For the +latter, \textsf{graphicx} provides a plea of (undocumented) +transformations: \texttt{interpolate}, \texttt{decodearray}, +\texttt{maskarray}, \texttt{intent}, \texttt{ocobjnum}, and +\texttt{ocobjref}. For transparency, see \textsf{transparent}, by +Heiko Oberdiek. + +This package is still evolving, but the basic behaviour described here +will be preserved in future versions. However, some functions from +\textsf{xcolor} might not work yet (for example +\verb|\selectcolormodel| and the corresponding package options |cmyk| +and the like). + +Declarations are global and should go in the preamble. + +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). + +\section{CMYK spot colors} + +Spot colors are defined with a single macro: + +\begin{decl} +|\definespotcolor{}{}{}| +\end{decl} + +Here || is the \LaTeX{} name, as used in \verb|\color| and +the like, || is the PDF name (usually taken from a swatch +book; multiple spaces are collapsed into one) as shown by PDF viewers, +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. + +To mix inks, see below. + +\begin{example} + Write, for example: +\begin{verbatim} +\definespotcolor{foo}{BarTone 555 GN}{.8,.2,.5,.3} +\end{verbatim} + This creates the color \showclr{foo}, which is used in \LaTeX{} as + |\color{foo}|. If you preflight the PDF file you will see a color + named `BarTone 555 GN' besides cyan, magenta, yellow and black. + +You can use tints as usual in \textsf{xcolor}, like: +\begin{verbatim} +\color{foo!50} +\colorlet{foo50}{foo!50} +\end{verbatim} +\ifcolorspace + which would produce \showclr{foo!50}, and +\fi +even set tints from other tints. +\end{example} + +\begin{note} + 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} +\end{note} + +\begin{note} + Remember as far PDF is concerned a spot color is a color space on + its own. +\end{note} + +\begin{note} + This package does not provide a list of Pantone, TrueMatch, HKS, + Folcoltone, Toyo, etc., colors. Currently you can find quite easily + CMYK equivalents on the web, and after all they are intended to be + used with a ``physical'' swatch book (and not, as often done, by + picking a color from a ``virtual'' palette just because it looks + nice on screen). +\end{note} + +\begin{decl} +|\definespotcolor{}{}[]{}| +\end{decl} + +Internally, only CMYK is used for the equivalent color, but with this +variant you can define the latter with another name space, which is +then converted. +\begin{example} The following definition is based on RGB: +\begin{verbatim} +\definespotcolor{foob}{BarTone 666 GN}[rgb]{.8, .2, .4} +\end{verbatim} + which yields \showclr{foob}. Here \textsf{xcolor} just + converts this value to CMYK, which is still the space used + internally. +\end{example} + +\begin{warning} + This conversion relies on the \textsf{xcolor} numerical methods, + which do not take into account any color profile and therefore + should be avoided in production if the alternate space is going to + be actually used. It is provided just for convenience in drafting or + in contexts where accuracy is not essential. +\end{warning} + +\section{CIE LAB spot colors} + +Instead of targeting the CMYK space, spot colors may be defined using +the CIE LAB (also known as L*a*b*, or even just Lab) space. Unlike the +default CMYK space, which is by default device dependend, the Lab +space is device independent. To define a Lab spot color, you must +first set the illuminant with the package option |illuminant|, which +takes a value: +\begin{verbatim} +\usepackage[illuminant=d65]{colorspace} +\end{verbatim} +Values are \texttt{a}, \texttt{c}, \texttt{e}, \texttt{d50}, +\texttt{d55}, \texttt{d65}, \texttt{d75}. + +The command to define a color is: +\begin{decl} +|\definespotcolor{}{}[alt=lab]{}| +\end{decl} +Note the optional argument with the string |alt=lab| (which cannot be +combined with a model). The three || have ranges +\textit{L}* $=$ $0$\ldots$100$, \textit{a}* $=$ $-$128$\ldots$127, +\textit{b}* $=$ $-$128{\ldots}127, respectively. + +\begin{example} + With +\begin{verbatim} +\definespotcolor{foolab}{BarTone 888 LB}[alt=lab]{50, -30, -40} +\end{verbatim} +the result is \showclr{foolab}. An example of tint is +\verb|\color{foolab!30}| (\showclr{foolab!30}). +\end{example} + +\begin{warning} + The package does not warn if the color falls outside the gamut of + the CMYK space or if the color is not visible. To put it in + other words, you should not just write some arbitrary values to see + what happens. +\end{warning} + +\begin{warning} + This model is not available in \textsf{xcolor}. If you need some + transformation, you must resort to an external tool like + \textsf{transicc} (or \textsf{icctrans}) included in Little + CMS\footnote{\texttt{http://www.littlecms.com/1/downloads.htm}}. +\end{warning} + +\begin{warning} + There is no default illuminant -- it must be set if Lab colors are + defined. +\end{warning} + +\begin{note} + The observer is currently only 2$^\circ$ (1931). +\end{note} + +The Lab space allows to define colors accurately, but there is a price +to pay -- mixing Lab colors is not in general possible except after +converting them somehow to CMYK or RGB.\footnote{There are no simple +rules to carry out those transformations, which, I think, explains why +\textsf{xcolor} does not support Lab at all}. Since currently mixing +colors in this package is based on CMYK, you must provide an alternate +value as shown, if mixed inks are required\footnote{Internally, and +in PDF jargon, Lab is the ``alternate space'' and ``tints transforms'' +are based on CMYK}: +\begin{verbatim} +\definespotcolor{foolab}{BarTone 888 LB}[alt=lab]{50, -30, -40/1, .20, .15, .07} +\end{verbatim} + +\section{Mixing spot colors} + +To mix spot colors you must first declare a color space (or model) +including them. This is done with the following macro: + +\begin{decl} + |\definecolorspace{}{mixed}{}| +\end{decl} + +Here, || is the name to be used in |\color| and the +like as the color model. The second argument is the string |mixed|, +and the last one is a list of up to 4 colors, either defined with +\textsf{xcolor} using the CMYK model or spot. + +\begin{example} + A simple and typical usage would be for shades: +\begin{verbatim} +\definecolorspace{fooshaded}{mixed}{foo,black} +\end{verbatim} + Then, you can define a color in this new model named + \verb|fooshaded| with: +\begin{verbatim} +\definecolor{darkfoo}{fooshaded}{.6,.3} +\end{verbatim} +Or set it with: +\begin{verbatim} +\color[fooshaded]{.6,.3} +\end{verbatim} +In both cases, the mix is 60\% \verb|foo| and 30\% \verb|black|. +\end{example} + +\begin{example} + If we have two spot colors named \verb|spot1| and \verb|spot2|, and + we want in addition yellow: +\begin{verbatim} +\definecolorspace{mix12y}{mixed}{spot1,spot2,yellow} +\end{verbatim} +To define a new color based on this space: +\begin{verbatim} +\definecolor{mix12y}{mix12y}{.5,.4,.6} +\end{verbatim} +And to set it: +\begin{verbatim} +\color[mix12y]{.5,.4,.6} +\end{verbatim} +\end{example} + +\begin{example} +Here is a duotone mixing the \verb|foob| and \verb|foolab| colors defined above: +\begin{verbatim} +\definecolorspace{labshaded}{mixed}{foolab,foob} +\end{verbatim} +The colors corresponding to: +\begin{verbatim} +\color[labshaded]{1,0} \color[labshaded]{.8,.2} +\color[labshaded]{.6,.4} \color[labshaded]{.4,.6} +\color[labshaded]{.2,.8} \color[labshaded]{0,1} +\end{verbatim} +are \showclr[labshaded]{1,0} \showclr[labshaded]{.8,.2} + \showclr[labshaded]{.6,.4} \showclr[labshaded]{.4,.6} + \showclr[labshaded]{.2,.8} \showclr[labshaded]{0,1} +\end{example} + +\begin{warning} + Due to internal limitations of \textsf{xcolor}, no more than four + colors are allowed. +\end{warning} + +\begin{note} + The alternate color space in the PDF file is that of the spot colors + (which means currently it is CMYK). +\end{note} + +\begin{note} + 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}{mix12y}{1,0,0} +\definecolor{xspot2}{mix12y}{0,1,0} +\definecolor{xyellow}{mix12y}{0,0,1} +\end{verbatim} + and then you can say: +\begin{verbatim} +\color{xspot1!30!xspot2!40!xyellow} +\color{mix12y:xspot1,3;xspot2,2;xyellow,1} +\end{verbatim} + Of course, it is just a trick and a better and direct interface is + under study (none of those provided by \textsf{xcolor} fits well + with the new |mixed| models). +\end{note} + +\begin{warning} + Mixing colors in \verb|\color|, \verb|\definecolor| and the like + from diferent spaces can lead to unexpected results (currently no + checking is done). +\end{warning} + +Color series (see the \textsf{xcolor} documentation) are also +partially supported. For example: +\begin{verbatim} +\definecolorseries{test}{mix12y}{grad}[mix12y]{.95,.85,.55}{3,11,17} +\definecolorseries{test}{mix12y}{last}{xyellow!50}{xspotA} +\end{verbatim} + +\ifcolorspace +\begin{example} + Here is a example with some of the described techniques, based on + the |fooshaded| space defined above (figure 1 shows the |foo| + plate): + +\begin{verbatim} +\definecolor{sfoo}{fooshaded}{1,0} +\definecolor{sblack}{fooshaded}{0,1} +\definecolorseries{shseries}{fooshaded}{last}{sfoo!40}{sblack} +\def\testclr#1{{\fboxsep0pt\fbox{\colorbox{#1}{\phantom{XX}}}}} +\resetcolorseries[8]{shseries} +\begin{tabular}{cccccccc} + 0 \testclr{shseries!!+} & + 1 \testclr{shseries!!+} & + 2 \testclr{shseries!!+} & + 3 \testclr{shseries!!+} & + 4 \testclr{shseries!!+} & + 5 \testclr{shseries!!+} & + 6 \testclr{shseries!!+} & + 7 \testclr{shseries!!+} +\end{tabular} +\end{verbatim} + +\begingroup +\def\testclr#1{{\fboxsep0pt\fbox{\colorbox{#1}{\phantom{XX}}}}} +\resetcolorseries[8]{shseries} +\begin{tabular}{cccccccc} + 0 \testclr{shseries!!+} & + 1 \testclr{shseries!!+} & + 2 \testclr{shseries!!+} & + 3 \testclr{shseries!!+} & + 4 \testclr{shseries!!+} & + 5 \testclr{shseries!!+} & + 6 \testclr{shseries!!+} & + 7 \testclr{shseries!!+} +\end{tabular} +\endgroup +\end{example} +\fi + +\begin{figure} +\fbox{\includegraphics[width=\linewidth]{colorspaceshade.png}} +\caption{Plate for the \texttt{foo} spot color as shown by Adobe +Acrobat. Note both \texttt{foob} and \texttt{foolab}, +defined in this document, are listed, too.} +\end{figure} + +\section{Page color spaces} + +Each PDF page must know which colors will be used (other than the +predefined CMYK, RGB and Gray). By default, \textsf{colorspace} turns +on for every page all newly defined colors, and that will be fine in +most cases. However, you may want to set explicitly the list (for +covers or plates). Use this feature with care, because (1) the +asynchronous nature of \TeX{} (remember it affects the whole current +page), and (2) each distinct color list creates a PDF resource. + +\begin{decl} +|\pagecolorspace{}|\\ +|\resetpagecolorspace| +\end{decl} + +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|. + +\section{ICC based spaces} + +\begin{decl} + |\definecolorspace*{}{iccbased}{}| +\end{decl} +The starred version \verb|\definecolorspace*| does not define a new +color model, but sets the behaviour of the three basic color spaces +(CMYK, RGB and Gray). When belonging to the same space, the last +definition for that space takes precedence and it is considered the +default one. 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|. Alternatively, there +are 3 reserved names: \verb|*rgb|, \verb|*gray|, \verb|*cmyk|, which +stand for the last-defined, default ICC based spaces. Named ICC based +spaces are not set by \verb|\resetpagecolorspace|, but the starred +named are. On the other hand, the starred names are not set +automatically by |\pagecolorspace|, and you must set them explicitly +if you want them to be active. + +\begin{note} + Those ICC spaces do 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. +\end{note} + +\begin{example} + Given the following declarations: +\begin{verbatim} +\definecolorspace*{sRGB}{iccbased}{sRGB Profile.icc} +\definecolorspace*{colormatch}{ColorMatchRGB.icc} +\end{verbatim} + and remembering the RGB space is always active (like the CMYK and + Gray ones), +\begin{verbatim} +\pagecolorspace{} +\end{verbatim} +leaves the RGB space unprofiled; +\begin{verbatim} +\pagecolorspace{sRGB} +\end{verbatim} +sets the RGB space to sRGB; while the following are (in this +particular example) equivalent: +\begin{verbatim} +\pagecolorspace{colormatch} +\pagecolorspace{*rgb} +\resetpagecolorspace +\end{verbatim} + +\end{example} + +\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 +in soft proofing. 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. + +\begin{warning} + Some PDF viewers ignore this setting. +\end{warning} + +\section{Version} + +1.1.1. No new features. Just internal changes related to +\textsc{luatex} and new manual. + +1.2.0. CIE LAB spot colors and |illuminant|. Manual rewritten. + +1.3. Fixes several incompatibilities with \textsf{pgf}/\textsf{tikz}. + +\end{document} + +MIT License +----------- + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/macros/latex/contrib/colorspace/colorspaceshade.png b/macros/latex/contrib/colorspace/colorspaceshade.png new file mode 100644 index 0000000000..a19328e041 Binary files /dev/null and b/macros/latex/contrib/colorspace/colorspaceshade.png differ -- cgit v1.2.3