~tex-sx/tex-sx/development

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
% \iffalse meta-comment
%<*internal>
\iffalse
%</internal>
%<*readme>
----------------------------------------------------------------
xspotcolor --- better integration of spot colors in LaTeX
E-mail: Stephan.Lehmke@QuinScape.de
Web: www.docscape.de
Released under the LaTeX Project Public License v1.3c or later
See http://www.latex-project.org/lppl.txt
----------------------------------------------------------------

This package provides some patches and additions to the code from the
"spotcolor" package to integrate it more smoothly with LaTeXs standard
color management.

The image file spotcolorseparation.png is needed for generating the
documentation.

Please run pdflatex on xspotcolor.dtx to generate xspotcolor.sty and
the test file xspotcolorxmpl.tex.
%</readme>
%<*internal>
\fi
\def\nameofplainTeX{plain}
\ifx\fmtname\nameofplainTeX\else
  \expandafter\begingroup
\fi
%</internal>
%<*install>
\input docstrip.tex
\keepsilent
\askforoverwritefalse
\preamble
----------------------------------------------------------------
xspotcolor --- better integration of spot colors in LaTeX
E-mail: Stephan.Lehmke@QuinScape.de
Web: www.docscape.de
Released under the LaTeX Project Public License v1.3c or later
See http://www.latex-project.org/lppl.txt
----------------------------------------------------------------

\endpreamble
\postamble

Copyright (C) 2012 by Stephan Lehmke <Stephan.Lehmke@QuinScape.de>

This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License (LPPL), either
version 1.3c of this license or (at your option) any later
version.  The latest version of this license is in the file:

http://www.latex-project.org/lppl.txt

This work is "maintained" (as per LPPL maintenance status) by
Stephan Lehmke.

This work consists of the files xspotcolor.dtx
                                spotcolorseparation.png
and the derived files           xspotcolor.ins,
                                xspotcolor.pdf, 
                                xspotcolor.sty, and
                                xspotcolorxmpl.tex

\endpostamble
\usedir{tex/latex/xspotcolor}
\generate{
  \file{\jobname.sty}{\from{\jobname.dtx}{package}}
}
%</install>
%<install>\endbatchfile
%<*internal>
\usedir{source/latex/xspotcolor}
\generate{
  \file{\jobname.ins}{\from{\jobname.dtx}{install}}
}
\nopreamble\nopostamble
\usedir{doc/latex/xspotcolor}
\generate{
  \file{README.txt}{\from{\jobname.dtx}{readme}}
}
\ifx\fmtname\nameofplainTeX
  \expandafter\endbatchfile
\else
  \expandafter\endgroup
\fi
%</internal>
%<*package>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{xspotcolor}[2013/11/21 v1.1 better integration of spot colors in LaTeX]
%</package>
%<*driver>

\begin{filecontents*}{xspotcolorxmpl.tex}
\documentclass[a5paper,12pt]{article}

% Load the package plus TikZ to do some examples.
\usepackage{xspotcolor}
\usepackage{tikz}
\usetikzlibrary{lindenmayersystems}

% We define a single spot color space for the whole document.
\NewSpotColorSpace{Document}

% This definition was copied from the file spotcolorpantone.tex.
\AddSpotColor{Document}{PANTONE3035PC}{PANTONE\SpotSpace 3035\SpotSpace PC}{1 0 0.05 0.72}

% Some arbitrary spot color definitions just to demonstrate how it works.
\AddSpotColor{Document}{SunYellow}{Sunny\SpotSpace Yellow}{0 0.09 0.97 0}
\AddSpotColor{Document}{SnotGreen}{Snot\SpotSpace Green}{0.26 0 0.30 0.12}
\AddSpotColor{Document}{FrogGreen}{Frog\SpotSpace Green}{0.78 0 0.59 0.34}

% Now we define several LaTeX colors as tints of the spot colors.
\definecolor{mypagecolor}{spotcolor}{SnotGreen,0.3}
\definecolor{bgcolor}{spotcolor}{SunYellow,0.6}
\definecolor{treegreen}{spotcolor}{FrogGreen,0.9}

\definecolor{PANTONE3035PC}{spotcolor}{PANTONE3035PC,1.0}
\definecolor{PANTONE3035PC-80}{spotcolor}{PANTONE3035PC,.8}

% Redefine emphasis.
\DeclareRobustCommand\em{\color{PANTONE3035PC-80}}


\pagestyle{empty}

\begin{document}

% As all spot colors for this document are in a single color space,
% this is needed only once.
\SetPageColorSpace{Document}

% Demonstration of different uses of spot colors.
\pagecolor{mypagecolor}

The \emph{Pantone color} can be used in text by the ordinary commands
for color switching.

\textcolor[spotcolor]{PANTONE3035PC,.4}{Different tints of the same color can be
  used.}

\bigskip

\noindent
TikZ Picture:

\bigskip

% The following code is taken from a question by Stefan Kottwitz on
% tex.stackexchange.com.
\noindent
\colorbox{bgcolor}
{%
  \begin{tikzpicture}
    \draw [color=treegreen, l-system={rule set={S -> [+++G][---G]TS,
        G -> +H[-G]L, H -> -G[+H]L, T -> TL, L -> [-FFF][+FFF]F}, step=4pt, angle=18,
      axiom=+++++SLFFF, order=11}] lindenmayer system -- cycle;
  \end{tikzpicture}
}
\end{document}
\end{filecontents*}

\documentclass{ltxdoc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{float}
\usepackage{\jobname}
\usepackage{tikz}
\usepackage{lipsum}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage[latin,english]{babel}

\makeatletter
\input{t1lmtt.fd}
\DeclareFontShape{T1}{lmtt}{m}{it}
     {<-> sub*lmtt/m/sl}{}

\DeclareRobustCommand\textequals{=}
\newcommand\ttarg[1]{\texttt{\meta{#1}}}
\newcommand\default[1]{\par\vspace{-2\baselineskip}\mbox{}\hfill
  Default: \textbf{#1}\par\medskip}
\newcommand\usageindex[1]
{%
  \@bsphack
  \HD@page@wrindex{#1\actualchar{\protect\ttfamily#1}\encapchar usage}%
  \@esphack
}
\newcommand\ttindex[1]
{%
  \@bsphack
  \HD@page@wrindex{#1\actualchar{\protect\ttfamily#1}}%
  \@esphack
}
\newcommand\pindex[1]
{%
  \@bsphack
  \HD@page@wrindex{#1\actualchar{\protect\ttfamily#1} \mbox{(package)}}%
  \HD@page@wrindex{packages:\levelchar#1\actualchar{\protect\ttfamily#1}}%
  \@esphack
}
\DeclareRobustCommand\package[1]{\texttt{#1}\pindex{#1}}

\newcommand\poindex[1]
{%
  \@bsphack
  \HD@page@wrindex{#1\actualchar{\protect\ttfamily#1} \mbox{(package option)}}%
  \HD@page@wrindex{package options:\levelchar#1\actualchar{\protect\ttfamily#1}}%
  \@esphack
}
\DeclareRobustCommand\packageoption[1]{\texttt{#1}\poindex{#1}}

\newcommand\eoindex[1]
{%
  \@bsphack
  \HD@page@wrindex{#1\actualchar{\protect\ttfamily#1} \mbox{(environment option)}}%
  \HD@page@wrindex{environment options:\levelchar#1\actualchar{\protect\ttfamily#1}}%
  \@esphack
}
\DeclareRobustCommand\environmentoption[1]{\texttt{#1}\eoindex{#1}}

\newcommand\dontsplit
{\@nobreaktrue\nopagebreak}

\renewcommand*\descriptionlabel[1]{\hspace\labelsep
                                \normalfont\bfseries\boldmath #1}

\makeatother

\usepackage[numbered]{hypdoc}
\definecolor{lstbgcolor}{rgb}{0.9,0.9,0.9} 
 
\usepackage{listings}
\lstloadlanguages{[LaTeX]TeX}
\lstset{breakatwhitespace=true,breaklines=true,language=TeX}
 
\usepackage{fancyvrb}

\renewcommand\topfraction{.9}
\renewcommand\bottomfraction{.5}
\renewcommand\textfraction{.1}
\renewcommand\floatpagefraction{.8}


\newfloat{Example}{hbtp}{loe}

\newenvironment{example}[2]
  {\def\excaption{#1}\def\exlabel{#2}%
    \VerbatimEnvironment
   \begin{VerbatimOut}[gobble=2]{example.out}}
  {\end{VerbatimOut}
   \begin{Example}
     \centering\parindent0pt
   \fbox{\begin{minipage}{.9\linewidth}
     \lstset{breakatwhitespace=true,breaklines=true,language=[LaTeX]TeX,basicstyle=\small\ttfamily,flexiblecolumns}
     \lstinputlisting[]{example.out}
   \end{minipage}}

   \fbox{\begin{minipage}{.9\linewidth}
     \footnotesize\parindent=1em
     \input{example.out}
   \end{minipage}}%

 \caption{\excaption}\label{\exlabel}
\end{Example}
}

\newenvironment{texcode}
{%
  \lstset{breakatwhitespace=true,breaklines=true,language=[LaTeX]TeX,basicstyle=\small\ttfamily,flexiblecolumns}
  \begin{lstlisting}
}
{%
  \end{lstlisting}
}

\newenvironment{quotecode}
{%
  \begin{quote}
  \begin{lrbox}{\pqbox}
    \begin{minipage}{\dimexpr\linewidth-2\fboxsep-2\fboxrule\relax}
}
{
  \end{minipage}
  \end{lrbox}
    \fbox{\usebox{\pqbox}}
  \end{quote}
}

\immediate\write18{makeindex -s gglo.ist -o xspotcolor.gls xspotcolor.glo}
\immediate\write18{makeindex -s gind.ist xspotcolor.idx}

\EnableCrossrefs
\CodelineIndex
\RecordChanges
\begin{document}
  \DocInput{\jobname.dtx}
  \PrintChanges
  \PrintIndex
\end{document}
%</driver>
% \fi
%
%
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
%
% \changes{1.0}{2013/11/16}{Converted to DTX file}
%
% \DoNotIndex{\newcommand,\newenvironment}
% \DoNotIndex{\def,\long,\edef,\xdef,\gdef,\let,\global}
% \DoNotIndex{\if,\ifnum,\ifdim,\ifcat,\ifmmode,\ifvmode,\ifhmode,%
%             \iftrue,\iffalse,\ifvoid,\ifx,\ifeof,\ifcase,\else,\or,\fi}
% \DoNotIndex{\box,\copy,\setbox,\unvbox,\unhbox,\hbox,%
%             \vbox,\vtop,\vcenter}
% \DoNotIndex{\@empty,\empty,\immediate,\write,\@tempdima,\@tempdimb,\@tempcnta,\@tmp}
% \DoNotIndex{\egroup,\bgroup,\expandafter,\begingroup,\endgroup}
% \DoNotIndex{\divide,\advance,\multiply,\count,\dimen}
% \DoNotIndex{\relax,\space,\string}
% \DoNotIndex{\csname,\endcsname,\@spaces,\openin,\openout,%
%             \closein,\closeout}
% \DoNotIndex{\catcode,\endinput}
% \DoNotIndex{\jobname,\message,\read,\the,\noexpand}
% \DoNotIndex{\hsize,\vsize,\hskip,\vskip,\kern,\hfil,\hfill,\hss}
% \DoNotIndex{\m@ne,\z@,\z@skip,\@ne,\tw@,\p@,\strip@pt}
% \DoNotIndex{\dp,\wd,\ht,\vss,\unskip}
% \DoNotIndex{\@nil,\do,\next,\repeat}
% \DoNotIndex{\ ,\vspace}
% \DoNotIndex{\dimexpr,\numexpr,\number}
% \DoNotIndex{\@@}
% \tolerance9999
% \providecommand*{\url}{\texttt}
% \GetFileInfo{xspotcolor.dtx}
% \newsavebox\pqbox
% \makeatletter
% \gdef\tshortstack{\@ifnextchar[\@tshortstack{\@tshortstack[c]}}
% \gdef\@tshortstack[#1]{%
%   \leavevmode
%   \vtop\bgroup
%     \baselineskip-\p@\lineskip 3\p@
%     \let\mb@l\hss\let\mb@r\hss
%     \expandafter\let\csname mb@#1\endcsname\relax
%     \let\\\@stackcr
%     \@ishortstack}
% \makeatother
% \title{The \textsf{xspotcolor} package}
% \author{Stephan Lehmke \\ \url{mailto:Stephan.Lehmke@QuinScape.de} \\ \url{www.docscape.de}}
% \date{\fileversion~from \filedate}
%
%
% \maketitle
%
% \begin{abstract}
%   The \texttt{spotcolor} package provides an implementation of
%   \emph{spot colors} for PDF files generated with \LaTeX. While it
%   gets the PDF technology completely right, the user interface does
%   not work with the packages |xcolor| and thus TikZ which are in
%   widespread use particularly for `colorful' \LaTeX{} documents.
%
%   This package provides some patches and integration between
%   \texttt{spotcolor} and the \texttt{xcolor} and \texttt{tikz}
%   packages which allow spot colors to be used like all other colors
%   in a \LaTeX{} document, in text as well as in images created with
%   the TikZ package.
% \end{abstract}
%
% \tableofcontents
% 
% \iffalse\listof{Example}{Examples}\fi
%
% 
%
% \section{Introduction}
%
% \emph{Spot color} is a term from printing technology referring to
% any color which has its own ink. So basically, in the usual CMYK
% printing process, \emph{Cyan}, \emph{Magenta}, \emph{Yellow}, and
% \emph{Black} are spot colors.
%
% The purpose of the \package{spotcolor} package is to provide support
% for \emph{additional} spot colors. Adding a spot color means that an
% additional type of ink (and hence, printing plate and run) needs to
% be added to the printing process. Sometimes this is used to extend
% the usual CMYK colors (by silver or gold, for instance, or by a
% specific \emph{corporate color} which cannot be produced adequately
% by CMYK), but more often, a two-color (or three-color) process is
% desired (combining black and one or two specific colors) to save printing
% costs. Any spot color can come in any number of \emph{tints}. In a
% sense, that's a mixture of the original color with white, making it
% lighter. Like the \emph{gray} color model which is based on black
% and allows all different shades of gray right until white.
%
% The \package{spotcolor} package contains all the neccessary
% definitions for adding and maintaining spot colors in a PDF document
% produced with \LaTeX{} and \texttt{pdftex}, but unfortunately it is
% not very well integrated with the standards of color management in
% \LaTeX, which basically means the \package{xcolor} package, plus
% \package{tikz} for making diagrams. This makes it hard to actually
% use spot colors provided by \package{spotcolor} in \LaTeX{} documents.
%
% This package provides some patches and small extensions to the
% mentioned packages which make them more seamlessly integrated, so that spot
% colors can be used just like any other colors in a \LaTeX{} document.
%
% The package was implemented in the course of answering the questions
% \href{http://tex.stackexchange.com/questions/141245/using-pantone-spot-colors-and-tikz-together}{``Using
% Pantone/spot colors and TikZ together''} and
% \href{http://tex.stackexchange.com/questions/145274/spotcolor-bleeds-into-the-surrounding}{``Spotcolor
% bleeds into the surrounding''} on the
% \href{http://tex.stackexchange.com}{Q\&A site \TeX\ Stack
% Exchange}. Report bugs at \href{https://launchpad.net/tex-sx/}{the
% \TeX-SX Launchpad site}. There is also a
% \href{http://chat.stackexchange.com/rooms/409/from-answers-to-packages}{chatroom}
% dedicated to the \TeX-SX packages.
%
%
% \section{Requirements}\label{sec:Requirements}
%
% \subsection{Required Packages}
%
% The \package{xspotcolor} package automatically loads the following
% further packages: \package{etoolbox}, \package{spotcolor},
% \package{xcolor}.
%
% If you're using the \package{tikz} package, you should load it after
% \package{xspotcolor}. 
%
% \section{Usage}
%
% As this package doesn't add much to the packages it integrates, most
% aspects of usage are covered much better in the documentation of the
% `parent' packages, in particular \package{spotcolor}, which you
% should also consult.
%
% In the following usage documentation, a ``unified view'' is
% presented which is created by combining the interface of the
% original \package{spotcolor} package with \LaTeX{}s standard color
% management. 
%
% \subsubsection*{Note}
%
% If you are considering to put spot colors in your document, then
% quite probably you know more about spot colors than I do. I'm just
% the guy who can read \TeX{} code and did some testing and fixing on
% the package
% interfaces. So if you find any errors or inconsistencies in the
% following documentation, feel free to ignore it, file a bug report
% or contact me by email to get it fixed.
%
%
% \subsection{Package Options}\label{sec:Usage:PackageOptions}
% 
% The \package{xspotcolor} package offers just one specific package option:
% \begin{description}
% \item[\packageoption{autodefine}] When this option is given, the
%   command |\AddSpotColor| will automatically \emph{also} define a
%   \LaTeX{} color. See sections \ref{sec:Usage:DefiningSpotColor} and
%   \ref{sec:Usage:DefiningLaTeXColor}.
% \end{description}
% 
% Besides that, the options of the \package{spotcolor} package are
% recognized. These are in particular the options \packageoption{hks}
% and \packageoption{pantone} to preload color definitions (see the
% \package{spotcolor} documentation).
%
% \subsubsection*{Note}
% I do not recommend using the options \packageoption{hks} and
% \packageoption{pantone}. Using them will practically declare that
% \emph{all} defined colors of the respective color space can be used
% on a page (although probably very few are actually used). On
% testing, I have experienced errors in Acrobat Professional trying to
% do a color separation from such a PDF.
%
% In reality, only very few (probably only one or two) spot colors
% will actually be used in one document. To be safe, you should
% declare only those colors you are using (see section
% \ref{sec:Usage:DeclaringColors}). 
% 
% \subsection{Declaring Colors}\label{sec:Usage:DeclaringColors}
% To use spot colors in a document, you need to do three things:
% \begin{enumerate}
% \item Declare a \emph{color space}.
% \item Define a \emph{spot color} within this color space.
% \item Afterwards, you can either use the spot color directly or
%   define a \emph{color} in \LaTeX{}s usual sense as a \emph{tint} of
%   a spot color.
% \end{enumerate}
%
% \subsubsection{Declaring a Color Space}
%
% Concerning the handling of spot colors in a PDF file, a \emph{color
% space} is an object declaring which spot colors can be used on a
% specific page. If you wish to use different sets of spot colors on
% different pages of the document, you can organise them in different
% spaces and switch between pages.
%
% But any page containing a spot color \textbf{must} have a color space
% containig that color, and every page can have at most \textbf{one}
% color space.
%
% For practical purposes, it is probably easiest to have one color
% space per document, put all the relevant spot colors in there and
% select it once and for all at the beginning of the document.
%
% A color space is declared by 
% \begin{quotecode}
%   |\NewSpotColorSpace{|\ttarg{space}|}|
% \end{quotecode}
% where \ttarg{space} is an arbitrary string which is used by other
% commands to refer to that space. As it will go literal in the PDF
% code, it should only contain ``safe'' characters (to be sure, better
% only use letters and numerals).
% 
%
% \subsubsection*{Note}
% All matters concerning spot colors should be discussed beforehand
% with your printer. How many and which spot colors are used has
% enormous implications for the printing process. Especially switching
% color spaces mid-document is probably highly complicated as pages
% have to be organised and printed in \emph{sheets} (of usually 16 or
% 32 pages) and spot colors have to be consistent for one sheet. The
% concequences of a misunderstanding between you and the print shop
% about the use of spot colors can be really vile, so make sure there
% is complete agreement and \emph{send them test files early!}
%
% As mentioned in section \ref{sec:Usage:PackageOptions}, I do not
% recommend packing for instance all Pantone colors into one
% \texttt{Pantone} color space as color separation tools could choke
% on too many different spot colors on one page, even if only a few
% are used. 
% 
% \subsubsection{Defining a Spot Color}\label{sec:Usage:DefiningSpotColor}
%
% A spot color is defined by 
% \begin{quotecode}
%   |\AddSpotColor{|\ttarg{space}|}{|\ttarg{name}|}{|\ttarg{PDF
%   name}|}{|\ttarg{CMYK Spec}|}|
% \end{quotecode}
% where \ttarg{space} is the name of a defined color space,
% \ttarg{name} is the name of the spot color to be defined, \ttarg{PDF
% name} is the color name which is put in the PDF file and \ttarg{CMYK
% Spec} is the CMYK replacement for situations where the spot color is
% not available.
%
% \ttarg{name} is used to refer to the spot color when defining a
% \LaTeX{} color based on it, while \ttarg{PDF name} is the name which
% will appear in the color separation dialogue of the application used
% to postprocess the PDF file. As \ttarg{PDF name} is written literal into the
% PDF file, it can't contain any spaces. The \package{spotcolor}
% package provides a macro |\SpotSpace| to denote a space character in
% a \ttarg{PDF name}. See the example in section
% \ref{sec:Usage:Example}.
%
% The CMYK color specified by \ttarg{CMYK Spec} is used in all
% situations (for instance, on screen or for digital printing) where
% the original spot color is not available.
%
% The original \texttt{spotcolor} package provides two files
% \texttt{spotcolorpantone.tex} and \texttt{spotcolorhks.tex} with spot
% color definitions for Pantone and HKS palettes, respectively. As
% mentioned above, \emph{I do not recommend to input these files, thereby
% preloading a full palette}. For practical purposes, it is enough to
% copy the definitions of those colors which are to be actually used
% into the document.
%
% If the package option \packageoption{autodefine} is given, then
% |\AddSpotColor| of the spot color named \ttarg{name} will
% automatically \emph{also} define a \LaTeX{} color of that name,
% denoting the ``100\% tint'' of that spot color.
%
% The example in section \ref{sec:Usage:Example} also demonstrates
% that \ttarg{PDF name} is just a string which is displayed in the
% color separation dialog. The PDF processing application does not
% auto-compare this name with a given palette. More likely, some human
% operator will read this text and go to the store room to fetch a can
% of ink.
%
% \textbf{This makes it all the more important to check beforehand
% with the print shop that you agree on spot colors, and get proofs!}
%
% \subsubsection{Defining a Tint of a Spot Color}\label{sec:Usage:DefiningLaTeXColor}
%
% When a spot color is defined by |\AddSpotColor|, this is comparable
% to a monochrome color model like \texttt{gray}: From a single spot
% color (in that case \textbf{black}), a lot of specific colors can be
% derived as \textit{tints}.
%
% Analogously, a specific color is defined as a tint of an already
% defined spot color by  
% \begin{quotecode}
%   |\definecolor{|\ttarg{color}|}{spotcolor}{|\ttarg{name}|,|\ttarg{tint}|}|
% \end{quotecode}
% where \ttarg{color} is the name of the new \LaTeX{} color to be defined,
% \ttarg{name} is the name of an already defined spot color, and
% \ttarg{tint} is a value between $0$ and $1$ giving the tint. $0$
% means white, $1$ is the ``full'' spot color.
%
% If the package option \packageoption{autodefine} is given, then
% |\AddSpotColor| of the spot color named \ttarg{name} will
% automatically \emph{also} define a \LaTeX{} color of that name,
% denoting the ``100\% tint'' of that spot color. So in that case, it is not
% neccessary to use |\definecolor| for the tint |1.0|, you can just
% use the name of the spot color.
%
% The color \ttarg{color} can then be used as any other color in
% \LaTeX{} (after the corresponding spot color space has been selected
% with |\SetPageColorSpace|; see section \ref{sec:Usage:Usage}). See
% the example in section \ref{sec:Usage:Example}.
%
% \subsection{Using Spot Colors in a Document}\label{sec:Usage:Usage}
%
% After everything is defined, spot colors need to be set up for use
% in the document with 
% \begin{quotecode}
%   |\SetPageColorSpace{|\ttarg{space}|}|
% \end{quotecode}
% where \ttarg{space} is the name of a defined color space. This
% configuration is valid from the current page to the end of the
% document, or until it is overriden by another call to
% |\SetPageColorSpace|.
%
% After issuing |\SetPageColorSpace|, spot colors, respectively
% defined colors based on spot colors in this space can be used just
% like other colors, that is, with commands like |\color|,
% |\pagecolor|, |\colorbox|, or as color specifications in TikZ
% drawings. See the example in section \ref{sec:Usage:Example}.
%
% If you have defined a spot color \ttarg{name} and don't want to
% define a \LaTeX{} color based on it, then you can (as usual)
% directly use (a tint of) this color by issuing
% \begin{quotecode}
%   |\color[spotcolor]{|\ttarg{name}|,|\ttarg{tint}|}|
% \end{quotecode}
% or, for instance, to print a piece of \ttarg{text} in a specific tint,
% \begin{quotecode}
%   |\textcolor[spotcolor]{|\ttarg{name}|,|\ttarg{tint}|}{|\ttarg{text}|}|
% \end{quotecode}
%
% The \package{spotcolor} package provides another macro for switching
% to a spot color: 
% \begin{quotecode}
%   |\SpotColor{|\ttarg{name}|}{|\ttarg{tint}|}|
% \end{quotecode}
% which is identical with |\color[spotcolor]{|\ttarg{name}|,|\ttarg{tint}|}|.
%
% \subsubsection*{Notes}
% \begin{enumerate}
% \item As mentioned above, configuring different pages with different color
% spaces by using |\SetPageColorSpace| several times in a document is
% possible, but might be problematic for the printing process and
% should be discussed with the print shop to avoid unpleasant
% surprises. In all cases, one page can have at most \emph{one} color space.
%
% For practical purposes, it is probably easiest to have one color
% space per document, put all the relevant spot colors in there and
% select it once and for all at the beginning of the document.
% 
% \item The original version of |\SpotColor| provided by the
% \package{spotcolor} package has a bug which will make the color
% `spill' out of a grouped context. This package adds a patch to make
% |\SpotColor| behave like |\color| in this respect.
% 
% \item Note that everything mentioned in this documentation applies
% to the original \package{spotcolor} package as well \emph{if you
% don't use \package{xcolor} or \package{tikz}}. In particular, if you
% load the packages \package{spotcolor} and \package{color}, then
% everything will work as described here.
%
% You should only avoid using |\SpotColor| as it is broken in the
% original \package{spotcolor} package.
%
% \item It should also be mentioned that advanced color features
% provided by |xcolor|, like mixing colors, are not available with
% spot colors.
% \end{enumerate}
% 
% \subsection{Example of Use}\label{sec:Usage:Example}
%
% The following example (file \texttt{xspotcolorxmpl.tex})
% demonstrates setting up and using spot colors in a \LaTeX{}
% document. Figure \ref{fig:example} shows the resulting PDF in the
% color separation view of Acrobat Professional (sorry for the German
% locale).
%   \begin{figure}
%     \centering
%     \includegraphics[width=\linewidth]{spotcolorseparation}
%     \caption{Example PDF in color separation dialog.}
%     \label{fig:example}
%   \end{figure}
% {%
%   \lstset{breakatwhitespace=true,breaklines=true,language=[LaTeX]TeX,basicstyle=\footnotesize\ttfamily,flexiblecolumns,backgroundcolor=\color{lstbgcolor}}
%   \lstinputlisting[]{xspotcolorxmpl.tex}
% }
% 
%
% \section{Limitations}\label{sec:Limitations}
%
% The main limitation is that currently the integration of spot colors
% with the |xcolor| package is superficial at best. The current patch
% ensures that simple definitions and use cases for spot colors work,
% but the |xcolor| package is brim full of case distinctions based on
% a predefined set of color models which I haven't even looked at.
%
% I tested mixing colors like this |\color{|\ttarg{some spot
% color}|!50!white}|, which threw an error, as expected. There is
% another way to get a tint of a spot color, and I don't even know if
% mixing spot colors with other colors is supported in any way by the
% PDF specification, but there may be other features of |xcolor| which
% make sense which could be supported.
%
%
% \section{Possible Extensions}\label{sec:Extensions}
%
% As mentioned above, a tighter integration into `xcolor` could be a
% good idea, to at least give a meaningful error message for cases
% that don't work.
%
% There are also certainly possible uses of spot colors within TikZ
% which are currently not covered, for instance making color gradients
% from tints of one spot color.
%
%
% \StopEventually{}
%
% \section{Implementation}
%
% \iffalse
%<*package>
% \fi
%
% \subsection{Initialization and Package Options}
% We load the required packages and setup
% options. The options of \package{spotcolor} are implemented here to
% make sure the preloading of the color definitions happens after
% potential redefinition of |\AddSpotColor| (see below).
%    \begin{macrocode}
\RequirePackage{etoolbox}
\RequirePackage{spotcolor}
\RequirePackage{xcolor}
%    \end{macrocode}
% We also set up a switch to check the \packageoption{autodefine} option.
%    \begin{macrocode}
\newif\ifautodefine@xspc
\DeclareOption{autodefine}{\autodefine@xspctrue}
%    \end{macrocode}
% The options \packageoption{hks} to preload hks color values into
% |HKS| colorspace and \packageoption{pantone} to preload pantone
% color values into |PANTONE| colorspace are duplicated here so that
% preloading does not happen prematurely.
%    \begin{macrocode}
\DeclareOption{hks}{\hkstrue}
\DeclareOption{pantone}{\pantonetrue}

\ProcessOptions\relax
%    \end{macrocode}
%
% \subsection{Patches}
% First, a patch to |spotcolor|s command |\SpotColor| so that it will
% apply |color|s color grouping magic to make spot colors behave well
% in groups (and boxes).
%    \begin{macrocode}
\apptocmd\SpotColor{\aftergroup\reset@color}{}{}
%    \end{macrocode}
% \changes{1.1}{2013/11/21}{Added `autodefine' option}
% If the \packageoption{autodefine} option was given, extend
% |\AddSpotColor| to define a \LaTeX{} color of the same name.
%    \begin{macrocode}
\ifautodefine@xspc
  \apptocmd\AddSpotColor{\definecolor{#2}{spotcolor}{#2,1.0}}{}{}
\fi
%    \end{macrocode}
% This makes |spotcolor| a defined color model for |xcolor|.
%    \begin{macrocode}
\XC@sdef\XC@mod@spotcolor{spotcolor}
%    \end{macrocode}
% Now, a patch to (|xcolor|s version of) |\definecolor|. I practically
% wrapped the original command in a case distinction filtering out
% colors with model |spotcolor|. A tighter integration would surely be
% better, but I can't fathom all the stuff that's going on in the
% original command.
%    \begin{macrocode}
\def\@@pdfspotcolordef@xspc#1,#2\@@{/#1 cs /#1 CS #2 sc #2 SC}
\let\o@XC@definec@lor@xspc\XC@definec@lor
\def\XC@definec@lor[#1]#2[#3]#4#5%
{%
  \expandafter\ifx\csname XC@mod@#4\endcsname\XC@mod@spotcolor
    \expandafter\xdef\csname\string\color @#2\endcsname
    {\noexpand\xcolor@{}{\@@pdfspotcolordef@xspc#5\@@}{spotcolor}{#5}}%
   \else
    \o@XC@definec@lor@xspc[#1]{#2}[#3]{#4}{#5}%
  \fi
}%
%    \end{macrocode}
% The following declares |pgf|-specific handlers for spot colors, to
% be used by TikZ.
%    \begin{macrocode}
\def\pgfsys@color@spotcolor@stroke#1#2{\pgfsysprotocol@literal{/#1 CS}\pgfsysprotocol@literal{#2 SC}}
\def\pgfsys@color@spotcolor@fill#1#2{\pgfsysprotocol@literal{/#1 cs}\pgfsysprotocol@literal{#2 sc}}
\def\pgfsys@color@spotcolor#1#2{\pgfsys@color@spotcolor@stroke{#1}{#2}\pgfsys@color@spotcolor@fill{#1}{#2}}
%    \end{macrocode}
%
%
% \subsection{Predefined Colors}
%
% If the package option \packageoption{hks} or \packageoption{pantone}
% have been given, then load the corresponding color tables now that
% |\AddSpotColor| has had the possibility to be patched.
%
%    \begin{macrocode}
\ifhks\input{spotcolorhks}\fi
\ifpantone\input{spotcolorpantone}\fi
%    \end{macrocode}
%
% \iffalse
%</package>
% \fi
%
% \Finale

\endinput