summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-01-02 22:50:58 +0000
committerKarl Berry <karl@freefriends.org>2016-01-02 22:50:58 +0000
commitf1a73737fea00318ecf19afd2d3b672d5770c6d8 (patch)
tree8a762de24b0080212aeeb2626e0f151baf9757c5 /Master
parent715eef9af8dbfecd729022ab22ca9c05caa0e16c (diff)
xespotcolor (2jan16)
git-svn-id: svn://tug.org/texlive/trunk@39257 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/xelatex/xespotcolor/README9
-rw-r--r--Master/texmf-dist/doc/xelatex/xespotcolor/jatestspot.pdfbin66609 -> 66609 bytes
-rw-r--r--Master/texmf-dist/doc/xelatex/xespotcolor/spotcolor-test.pdfbin70346 -> 70357 bytes
-rw-r--r--Master/texmf-dist/doc/xelatex/xespotcolor/spotcolor-test.tex2
-rw-r--r--Master/texmf-dist/doc/xelatex/xespotcolor/xespotcolor.pdfbin66205 -> 74284 bytes
-rw-r--r--Master/texmf-dist/source/xelatex/xespotcolor/xespotcolor.dtx212
-rw-r--r--Master/texmf-dist/source/xelatex/xespotcolor/xespotcolor.ins8
-rw-r--r--Master/texmf-dist/tex/xelatex/xespotcolor/xespotcolor.sty89
8 files changed, 211 insertions, 109 deletions
diff --git a/Master/texmf-dist/doc/xelatex/xespotcolor/README b/Master/texmf-dist/doc/xelatex/xespotcolor/README
index fa87f4ad2db..97caebfd91b 100644
--- a/Master/texmf-dist/doc/xelatex/xespotcolor/README
+++ b/Master/texmf-dist/doc/xelatex/xespotcolor/README
@@ -5,8 +5,9 @@ by Jens Elstner is a first attempt to introduce the use of
spot colors with pdfLaTeX. The xespotcolor package is a
reimplementation of this package so to be usable with
XeLaTeX or LaTeX+dvipdfmx. As such, it has the same user
-interface and the same capabilities. The recent version
-of xdvipdfm-x (svn revision 36553 and later) should be
-used to run the tests.
+interface and the same capabilities. Version 2.0 adds
+support for the xcolor package and so one can use
+spotcolors in TikZ pictures.
+
Apostolos Syropoulos
-2015/03/22
+2016/01/02
diff --git a/Master/texmf-dist/doc/xelatex/xespotcolor/jatestspot.pdf b/Master/texmf-dist/doc/xelatex/xespotcolor/jatestspot.pdf
index b588f2c575b..c681db61f28 100644
--- a/Master/texmf-dist/doc/xelatex/xespotcolor/jatestspot.pdf
+++ b/Master/texmf-dist/doc/xelatex/xespotcolor/jatestspot.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/xelatex/xespotcolor/spotcolor-test.pdf b/Master/texmf-dist/doc/xelatex/xespotcolor/spotcolor-test.pdf
index 06937cc7335..07f8a255ba2 100644
--- a/Master/texmf-dist/doc/xelatex/xespotcolor/spotcolor-test.pdf
+++ b/Master/texmf-dist/doc/xelatex/xespotcolor/spotcolor-test.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/xelatex/xespotcolor/spotcolor-test.tex b/Master/texmf-dist/doc/xelatex/xespotcolor/spotcolor-test.tex
index 9538301241e..d343d6bf575 100644
--- a/Master/texmf-dist/doc/xelatex/xespotcolor/spotcolor-test.tex
+++ b/Master/texmf-dist/doc/xelatex/xespotcolor/spotcolor-test.tex
@@ -4,7 +4,7 @@
\setmainfont[Mapping=tex-text]{Minion Pro}
\begin{document}
\color{blue}
- \bf\Huge Blue text color using color package
+ \bf\Huge Blue text color using the color package
\clearpage
\pagecolor{white}
diff --git a/Master/texmf-dist/doc/xelatex/xespotcolor/xespotcolor.pdf b/Master/texmf-dist/doc/xelatex/xespotcolor/xespotcolor.pdf
index befb2b786f3..2d9dbee1100 100644
--- a/Master/texmf-dist/doc/xelatex/xespotcolor/xespotcolor.pdf
+++ b/Master/texmf-dist/doc/xelatex/xespotcolor/xespotcolor.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/xelatex/xespotcolor/xespotcolor.dtx b/Master/texmf-dist/source/xelatex/xespotcolor/xespotcolor.dtx
index 107545eec8c..4844307a11c 100644
--- a/Master/texmf-dist/source/xelatex/xespotcolor/xespotcolor.dtx
+++ b/Master/texmf-dist/source/xelatex/xespotcolor/xespotcolor.dtx
@@ -16,7 +16,7 @@
%%
%\iffalse
%
-% (c) Copyright 2014-2015 Apostolos Syropoulos
+% (c) Copyright 2014-2016 Apostolos Syropoulos
% This program can be redistributed and/or modified under the
% terms of the LaTeX Project Public License Distributed from
% http://www.latex-project.org/lppl.txt; either
@@ -29,12 +29,12 @@
% Apostolos Syropoulos (asyropoulos@yahoo.com)
%
%\fi
-% \CheckSum{106}
+% \CheckSum{184}
% \iffalse This is a Metacomment
%
%<xespotcolor, >\ProvidesFile{xesporcolor.sty}
%
-%<xespotcolor, > [2015/03/21 v1.2 Package `xespotcolor.sty' (bug fix release)]
+%<xespotcolor, > [2016/01/02 v2.0 Package `xespotcolor.sty']
%
% \begin{macrocode}
%<*driver>
@@ -54,17 +54,19 @@
%\MakeShortVerb{\|}
%\StopEventually{}
%\title{The \textsf{xespotcolor} package:\\ Spot Colors for \XeLaTeX\ \&\ \LaTeX}
-%\author{Apostolos Syropoulos\\
+%\author{Απόστολος Συρόπουλος\\
+% (Apostolos Syropoulos)\\
% Xanthi, Greece\\
% \texttt{asyropoulos@yahoo.com}}
-% \date{2015/03/21}
+% \date{2016/01/02}
%\maketitle
% \begin{abstract}
% A spot color is one that is printed with its own ink. Typically, printers use spot colors
% in the production of books or other printed material. The \textsf{spotcolor} package
% by Jens Elstner is a first attempt to introduce the use of spot colors with pdfLaTeX.
% The \textsf{xespotcolor} package is a reimplementation of this package so to be usable with
-% \XeLaTeX\ and \LaTeX+\texttt{dvipdfmx}. As such, it has the same user interface and the same capabilities.
+% \XeLaTeX\ and \LaTeX+\texttt{dvipdfmx}. As such, it has the same user interface and the same
+% capabilities.
%\end{abstract}
%
%\section{Introduction}
@@ -143,54 +145,79 @@
%<*xespotcolor>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{xespotcolor}
- [2015/03/21 v.1.2, Package for adding Spot Color support to LaTeX/XeLaTeX.]
+ [2016/01/02 v.2.0, Package for adding Spot Color support to LaTeX/XeLaTeX.]
% \end{macrocode}
-% The package needs three packages in order to operate properly: \textsf{graphics}, \textsf{color}, and \textsf{everypage}.
-% The first two packages must be loaded with a driver/engine option, since auto-detection does not work in this case.
-% Since the package can be used with either \LaTeX\ or \XeLaTeX\ and the \texttt{dvipdfmx}/\texttt{xdvipdfmx} driver, respectively,
-% it is necessary to load these packages with the proper options. Akira Kakuto, who actually discovered that the package can be used
-% with \LaTeX, suggested the following code to properly load these packages:
+% The package needs three packages in order to operate properly: the \textsf{graphics} package, the
+% \textsf{everypage} package, and either the package \textsf{color} or the package \textsf{xcolor}.
+% The later is necessary if one wants to use spot colors with \textsf{TikZ} and other packages that
+% rely on package \textsf{xcolor}. Akira Kakuto has discovered that this package can be used with
+% either \LaTeX\ or \XeLaTeX\ and the \texttt{dvipdfmx}/\texttt{xdvipdfmx} driver, respectively.
+% However, in order to properly load the various packages it is necessary to know which typesetting
+% engine is being used. A simple solution is to use the \textsf{ifxetex} package:
% \begin{macrocode}
\RequirePackage{ifxetex}
+\RequirePackage{everypage}
+% \end{macrocode}
+% Before proceeding it is also necessary to know if the package \textsf{xcolor} has been loaded
+% (package \textsf{color} is loaded by default). The following command check if \textsf{xcolor}
+% is loaded. If it is, it defines a new macro.
+% \begin{macrocode}
+\@ifpackageloaded{xcolor}{\let\use@xcolor\relax}{}
+% \end{macrocode}
+% Now we are ready to process the three package options: \texttt{hks}, \texttt{pantone}, and \texttt{xcolor}.
+% Here we employ the same ``trick'': if an option is requested, we define a corresponding macro.
+% \begin{macrocode}
+\DeclareOption{hks}{\let\use@hks\relax}
+\DeclareOption{pantone}{\let\use@pantone\relax}
+\DeclareOption{xcolor}{\let\use@xcolor\relax}
+\ProcessOptions
+% \end{macrocode}
+% The code that follows loads the remaining two packages. If macro |\use@xcolor| is not
+% defined, then the package should load the \textsf{color} package; otherwise it should
+% load the \textsf{xcolor} package. The two inner |\if|s are used to load properly the packages
+% when \XeTeX\ or \TeX\ is used to typeset a document. In addition, to avoid unnecessary package
+% loadings, there are some tests to make sure the packages are not loaded.
+% \begin{macrocode}
+\ifx\use@xcolor\undefined
\ifxetex
- \RequirePackage[xetex]{graphics}
- \RequirePackage[xetex]{color}
+ \@ifpackageloaded{graphics}{}{\RequirePackage[xetex]{graphics}}
+ \@ifpackageloaded{color}{}\RequirePackage[xetex]{color}
\else
- \RequirePackage[dvipdfmx]{graphics}
- \RequirePackage{color}
+ \@ifpackageloaded{graphics}{}{\RequirePackage[dvipdfmx]{graphics}}
+ \@ifpackageloaded{color}{}\RequirePackage{color}
\fi
-\RequirePackage{everypage}
+\else
+\ifxetex
+ \@ifpackageloaded{graphics}{}{\RequirePackage[xetex]{graphics}}
+ \@ifpackageloaded{xcolor}{}{\RequirePackage[xetex]{xcolor}}
+\else
+ \@ifpackageloaded{graphics}{}{\RequirePackage[dvipdfmx]{graphics}}
+ \@ifpackageloaded{xcolor}{}{\RequirePackage{xcolor}}
+\fi\fi
% \end{macrocode}
-% The original package defines two ``Boolean'' variables that are set when the package is loaded with the \texttt{hks} and/or
-% the \texttt{pantone} options, respectively. When these variables are set to true, then the package pre-loads color values in the
-% corresponding color space (i.e., ``hks'' and ``pantone''). These color values are stored in two separate source files.
-% These files are part of the original package distribution.
+% The following command should be executed only when using \textsf{TikZ}. Thus, always load this
+% package after loading package \textsf{TikZ}.
% \begin{macrocode}
-\newif\ifhks\hksfalse
-\newif\ifpantone\pantonefalse
-\DeclareOption{hks}{\hkstrue}
-\DeclareOption{pantone}{\pantonetrue}
-\ProcessOptions
+\@ifpackageloaded{tikz}{\global\pgf@sys@pdf@colorspaces@existsfalse}{}
% \end{macrocode}
-%
-% The |\NewSpotColorSpace| command should be used to define a new color space for spot colors. The new color space can be
-% any imaginable word! This color space is the place where a new spot color will live. The \texttt{hks} and
-% the \texttt{pantone} options create two color spaces where the corresponding colors live.
+% The |\NewSpotColorSpace| command should be used to define a new color space for spot colors. The new color
+% space can be any imaginable word! This color space is the place where a new spot color will live. The
+% \texttt{hks} and the \texttt{pantone} options create two color spaces where the corresponding colors live.
% \begin{macrocode}
\def\NewSpotColorSpace#1{%
\expandafter\newtoks\csname #1\endcsname%
\csname #1\endcsname{}%
}
% \end{macrocode}
-% The |\AddSpotColor| macro should be used to introduce a new spot color. Thus it is one of the first commands on should play
-% with when using this package. This command takes four parameters---the name of a new color
-% space, which has been declared with |\NewSpotColorSpace|, the name of a new color, a name which will be used internally, and a
-% CMYK representation of the new color. For example, here is a typical use of this macro:
+% The |\AddSpotColor| macro should be used to introduce a new spot color. Thus it is one of the first commands
+% on should play with when using this package. This command takes four parameters---the name of a new color
+% space, which has been declared with |\NewSpotColorSpace|, the name of a new color, a name which will be
+% used internally, and a CMYK representation of the new color. For example, here is a typical use of this macro:
% \begin{center}
%|\AddSpotColor{NEWCS}{NEWCOLOR}{Name\SpotSpace in\SpotSpace PDF}{0.5 1.0 0.51 0}|
% \end{center}
-% Macro |\SpotSpace| is used to introduce blanks in names. According to the PDF standard a blank is denoted by the
-% character sequence |#20| and this is the reason why |\SpotSpace| is defined as follows:
+% Macro |\SpotSpace| is used to introduce blanks in names. According to the PDF standard a blank is denoted
+% by the character sequence |#20| and this is the reason why |\SpotSpace| is defined as follows:
% \begin{macrocode}
\catcode`\#=12%
\def\SpotSpace{#20}
@@ -208,64 +235,65 @@
\newcount\colorprofilecnt
\newtoks\mycolorprofilename
% \end{macrocode}
-% Macro |\AddSpotColor| first defines a new color profile by assigning a value to |\mycolorprofilename|. The name
-% consists of the word |@mycolorprofile| followed by an integer. This name is used in the construction of the
-% corresponding PDF object.
+% Macro |\AddSpotColor| first defines a new color profile by assigning a value to |\mycolorprofilename|. The
+% name consists of the word |@mycolorprofile| followed by an integer. This name is used in the construction
+% of the corresponding PDF object.
% \begin{macrocode}
\def\AddSpotColor#1#2#3#4{%
- \mycolorprofilename={@mycolorprofile\the\colorprofilecnt}%
+ \mycolorprofilename={@mycolorprofile\the\colorprofilecnt}%
% \end{macrocode}
% The following two macros expand to PDF instructions that define the spot color. The PDF instructions are copied verbatim from
% the original \textsf{spotcolor} package.
% \begin{macrocode}
- \edef\mycolorprofile{\the\mycolorprofilename
- <</C0[0 0 0 0]/FunctionType 2/C1[#4]/Domain[0 1]/N 1>>}%
- \edef\mycolor{[/Separation/#3 /DeviceCMYK \the\mycolorprofilename]}%
+ \edef\mycolorprofile{\the\mycolorprofilename
+ <</C0[0 0 0 0]/FunctionType 2/C1[#4]/Domain[0 1]/N 1>>}%
+ \edef\mycolor{[/Separation/#3 /DeviceCMYK \the\mycolorprofilename]}%
% \end{macrocode}
% The next two lines have been copied verbatim from the original macro definition.
% \begin{macrocode}
- \edef\tempcs{/#2 \mycolor}%
- \expandafter\csgrab\expandafter{\tempcs}{\csname #1\endcsname}%
+ \edef\tempcs{/#2 \mycolor}%
+ \expandafter\csgrab\expandafter{\tempcs}{\csname #1\endcsname}%
% \end{macrocode}
-% In the last part of the macro definition, the driver is instructed to build two objects which should contain the definition of
-% the new spot color. Note that here the macro specifies explicitly the object reference for the second object.
+% In the last part of the macro definition, the driver is instructed to build two objects which should
+% contain the definition of the new spot color. Note that here the macro specifies explicitly the object
+% reference for the second object.
% \begin{macrocode}
- \special{pdf:obj \mycolorprofile}%
- \special{pdf:obj @myowncolor\the\colorprofilecnt \mycolor}%
+ \special{pdf:obj \mycolorprofile}%
+ \special{pdf:obj @myowncolor\the\colorprofilecnt \mycolor}%
% \end{macrocode}
-% Since all names must be distinct the macro increments the value of the |\colorprofilecnt| counter by one.
+% Since all names must be distinct, the macro increments the value of the |\colorprofilecnt| counter by one.
% \begin{macrocode}
- \advance\colorprofilecnt by1%
+ \advance\colorprofilecnt by1%
}
% \end{macrocode}
%
% Command |\SetPageColorResource| is used by command |\SetPageColorSpace| to set the color space.
% The |\special| command below sets the page resources only for the current page. Since the color
-% space should be visible to every subsequent page, I have opted to use command |\AddEverypageHook| of the
-% \textsf{everypage} package.
+% space should be visible to every subsequent page, I have opted to use command the |\AddEverypageHook|
+% command provided by the \textsf{everypage} package.
% \begin{macrocode}
\def\SetPageColorResource#1{%
- \AddEverypageHook{\special{pdf:put @resources <</ColorSpace <<#1>>>>}}%
+ \AddEverypageHook{\special{pdf:put @resources <</ColorSpace <<#1>>>>}}%
}%
\def\SetPageColorSpace#1{%
- \expandafter\SetPageColorResource\expandafter{\the\csname #1\endcsname}%
+ \expandafter\SetPageColorResource\expandafter{\the\csname #1\endcsname}%
}%
% \end{macrocode}
% If a user wants to set a spot color as the default color, she should use the |\SpotColor| command:
% \begin{macrocode}
\def\SpotColor#1#2{%
- \special{pdf:literal /#1 cs /#1 CS #2 sc #2 SC}%
- \aftergroup\reset@color%
+ \special{pdf:literal /#1 cs /#1 CS #2 sc #2 SC}%
+ \aftergroup\reset@color%
}%
% \end{macrocode}
-% The commands |\color@spotcolor| and |\c@lor@@spotcolor| are ``low-level'' commands and should never be used by
-% anyone. These commands are used to define new spot colors. They are automatically
-% executed everytime a someone uses a command that defines a new spot color:
+% Suppose that a user wants to define a new spot color. Then, she has to issue a command like the
+% following one:
% \begin{center}
% |\definecolor{Spots}{spotcolor}{SPCOLOR,1.0}|
% \end{center}
-% Note that the second argument must always be |spotcolor|. In addition, this command is meaningful only when
-% one has defined a few things using command like the following ones:
+% Note that the second argument of this command must always be |spotcolor|, since this is the color
+% model we are using. In addition, this command is meaningful only when
+% one has defined a few things using commands like the following ones:
%\begin{center}
%\begin{tabular}{l}
%|\NewSpotColorSpace{SPCOLORSPACE}|\\
@@ -273,20 +301,64 @@
%|\SetPageColorSpace{SPCOLORSPACE}|\\
%\end{tabular}
%\end{center}
-% The code that follows has been taken and subsequently modified from \texttt{xetex.def},
-% which is {\em not yet} part of the Standard LaTeX ``Graphics Bundle.'' Note that these command work only
-% with \texttt{xdvipdfm-x} driver revision 36553 and later.
+%
+% Depending on which color package is in use, different low-level commands are executed in order to
+% actually define the new color. These new commands are provided by this package. In particular, when the
+% \textsf{color} package is used, these new commands are the |\color@spotcolor| command and |\c@lor@@spotcolor|
+% command. On the other hand, when using the \textsf{xcolor} package these new commands are the |\XC@mod@spotcolor|
+% command and the |\@@xespotcolordef@xspc| command.
+%
+% If variable |\use@xcolor| is undefined, this means that the user has opted to use the \textsf{color}
+% package.
+% \begin{macrocode}
+\ifx\use@xcolor\undefined
+% \end{macrocode}
+% The code that follows has been taken and subsequently modified from file \texttt{xetex.def},
+% which is {\em not yet} part of the Standard LaTeX ``Graphics Bundle'' (see the documentation of
+% the package's source code for more details).
% \begin{macrocode}
\def\color@spotcolor#1#2{\c@lor@@spotcolor#2\@@#1}
\def\c@lor@@spotcolor#1,#2\@@#3{%
- \c@lor@arg{#2}%
- \edef#3{spot #1 #2}%
+ \c@lor@arg{#2}%
+ \edef#3{spot #1 #2}%
}
% \end{macrocode}
-% If pantone or hks option specified then load corresponding color tables
+% The code that follows has been copied and subsequently modified from package
+% \textsf{xspotcolor}. Obviously, the code uses the infrastructure provided by
+% package \textsf{xcolor} to allow users to define new spot colors (see the
+% documentation of the source code of package \textsf{xcolor} for more details).
+% \begin{macrocode}
+\else
+\XC@sdef\XC@mod@spotcolor{spotcolor}
+\def\@@xespotcolordef@xspc#1,#2\@@{spot #1 #2}
+\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@{}{\@@xespotcolordef@xspc#5\@@}{spotcolor}{#5}}%
+ \else
+ \o@XC@definec@lor@xspc[#1]{#2}[#3]{#4}{#5}%
+ \fi
+}%
+% \end{macrocode}
+% Since \textsf{TikZ} is widely used today for drawing, the following commands are
+% redefined to allow the use of spot colors in pictures created with this package.
+% \begin{macrocode}
+\gdef\pgfsys@color@spotcolor@stroke#1#2{\special{pdf:literal /#1 CS #2 SC}}
+\gdef\pgfsys@color@spotcolor@fill#1#2{\special{pdf:literal /#1 cs #2 sc}}
+\gdef\pgfsys@color@spotcolor#1#2{\pgfsys@color@spotcolor@stroke{#1}{#2}%
+ \pgfsys@color@spotcolor@fill{#1}{#2}}
+\fi
+% \end{macrocode}
+% If the \texttt{pantone} or the \texttt{hks} option have be specified, then the package loads the corresponding
+% color tables
% \begin{macrocode}
-\ifhks\input{spotcolorhks}\fi
-\ifpantone\input{spotcolorpantone}\fi
+\ifx\use@hks\undefined\else\input{spotcolorhks}\fi
+\ifx\use@pantone\undefined\else\input{spotcolorpantone}\fi
%</xespotcolor>
% \end{macrocode}
% \Finale
+% \section*{Acknowledgements}
+% I would like to thank Akira Kakuto for his comments and suggestions. Also, I would like to thank
+% иеромонах Пантелеимон (Королев) [hieromonk Panteleimon] for his questions and testing.
diff --git a/Master/texmf-dist/source/xelatex/xespotcolor/xespotcolor.ins b/Master/texmf-dist/source/xelatex/xespotcolor/xespotcolor.ins
index c476fbfa99e..a12d6f712f4 100644
--- a/Master/texmf-dist/source/xelatex/xespotcolor/xespotcolor.ins
+++ b/Master/texmf-dist/source/xelatex/xespotcolor/xespotcolor.ins
@@ -1,9 +1,9 @@
-%% Copyright 2014-2015 Apostolos Syropoulos
+%% Copyright 2014-2016 Apostolos Syropoulos
%%
-%% This file is part of the `decimal' package.
+%% This file is part of the `xespotcolor' package.
%% You are not allowed to modify its contents.
%%
-\def\filedate{2015/03/18}
+\def\filedate{2016/01/02}
\def\batchfile{xespotcolor.ins}
\input docstrip.tex
@@ -24,7 +24,7 @@
\preamble
- (c) Copyright 2014-2015 Apostolos Syropoulos
+ (c) Copyright 2014-2016 Apostolos Syropoulos
This program can be redistributed and/or modified under the
terms of the LaTeX Project Public License Distributed from
http://www.latex-project.org/lppl.txt; either
diff --git a/Master/texmf-dist/tex/xelatex/xespotcolor/xespotcolor.sty b/Master/texmf-dist/tex/xelatex/xespotcolor/xespotcolor.sty
index 562639327c9..384995054b3 100644
--- a/Master/texmf-dist/tex/xelatex/xespotcolor/xespotcolor.sty
+++ b/Master/texmf-dist/tex/xelatex/xespotcolor/xespotcolor.sty
@@ -6,7 +6,7 @@
%%
%% xespotcolor.dtx (with options: `xespotcolor')
%%
-%% (c) Copyright 2014-2015 Apostolos Syropoulos
+%% (c) Copyright 2014-2016 Apostolos Syropoulos
%% This program can be redistributed and/or modified under the
%% terms of the LaTeX Project Public License Distributed from
%% http://www.latex-project.org/lppl.txt; either
@@ -36,24 +36,34 @@
%% Right brace \} Tilde \~}
%%
\ProvidesFile{xesporcolor.sty}
- [2015/03/21 v1.2 Package `xespotcolor.sty' (bug fix release)]
+ [2016/01/02 v2.0 Package `xespotcolor.sty']
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{xespotcolor}
- [2015/03/21 v.1.2, Package for adding Spot Color support to LaTeX/XeLaTeX.]
+ [2016/01/02 v.2.0, Package for adding Spot Color support to LaTeX/XeLaTeX.]
\RequirePackage{ifxetex}
+\RequirePackage{everypage}
+\@ifpackageloaded{xcolor}{\let\use@xcolor\relax}{}
+\DeclareOption{hks}{\let\use@hks\relax}
+\DeclareOption{pantone}{\let\use@pantone\relax}
+\DeclareOption{xcolor}{\let\use@xcolor\relax}
+\ProcessOptions
+\ifx\use@xcolor\undefined
\ifxetex
- \RequirePackage[xetex]{graphics}
- \RequirePackage[xetex]{color}
+ \@ifpackageloaded{graphics}{}{\RequirePackage[xetex]{graphics}}
+ \@ifpackageloaded{color}{}\RequirePackage[xetex]{color}
\else
- \RequirePackage[dvipdfmx]{graphics}
- \RequirePackage{color}
+ \@ifpackageloaded{graphics}{}{\RequirePackage[dvipdfmx]{graphics}}
+ \@ifpackageloaded{color}{}\RequirePackage{color}
\fi
-\RequirePackage{everypage}
-\newif\ifhks\hksfalse
-\newif\ifpantone\pantonefalse
-\DeclareOption{hks}{\hkstrue}
-\DeclareOption{pantone}{\pantonetrue}
-\ProcessOptions
+\else
+\ifxetex
+ \@ifpackageloaded{graphics}{}{\RequirePackage[xetex]{graphics}}
+ \@ifpackageloaded{xcolor}{}{\RequirePackage[xetex]{xcolor}}
+\else
+ \@ifpackageloaded{graphics}{}{\RequirePackage[dvipdfmx]{graphics}}
+ \@ifpackageloaded{xcolor}{}{\RequirePackage{xcolor}}
+\fi\fi
+\@ifpackageloaded{tikz}{\global\pgf@sys@pdf@colorspaces@existsfalse}{}
\def\NewSpotColorSpace#1{%
\expandafter\newtoks\csname #1\endcsname%
\csname #1\endcsname{}%
@@ -65,33 +75,52 @@
\newcount\colorprofilecnt
\newtoks\mycolorprofilename
\def\AddSpotColor#1#2#3#4{%
- \mycolorprofilename={@mycolorprofile\the\colorprofilecnt}%
- \edef\mycolorprofile{\the\mycolorprofilename
- <</C0[0 0 0 0]/FunctionType 2/C1[#4]/Domain[0 1]/N 1>>}%
- \edef\mycolor{[/Separation/#3 /DeviceCMYK \the\mycolorprofilename]}%
- \edef\tempcs{/#2 \mycolor}%
- \expandafter\csgrab\expandafter{\tempcs}{\csname #1\endcsname}%
- \special{pdf:obj \mycolorprofile}%
- \special{pdf:obj @myowncolor\the\colorprofilecnt \mycolor}%
- \advance\colorprofilecnt by1%
+ \mycolorprofilename={@mycolorprofile\the\colorprofilecnt}%
+ \edef\mycolorprofile{\the\mycolorprofilename
+ <</C0[0 0 0 0]/FunctionType 2/C1[#4]/Domain[0 1]/N 1>>}%
+ \edef\mycolor{[/Separation/#3 /DeviceCMYK \the\mycolorprofilename]}%
+ \edef\tempcs{/#2 \mycolor}%
+ \expandafter\csgrab\expandafter{\tempcs}{\csname #1\endcsname}%
+ \special{pdf:obj \mycolorprofile}%
+ \special{pdf:obj @myowncolor\the\colorprofilecnt \mycolor}%
+ \advance\colorprofilecnt by1%
}
\def\SetPageColorResource#1{%
- \AddEverypageHook{\special{pdf:put @resources <</ColorSpace <<#1>>>>}}%
+ \AddEverypageHook{\special{pdf:put @resources <</ColorSpace <<#1>>>>}}%
}%
\def\SetPageColorSpace#1{%
-\expandafter\SetPageColorResource\expandafter{\the\csname #1\endcsname}%
+ \expandafter\SetPageColorResource\expandafter{\the\csname #1\endcsname}%
}%
\def\SpotColor#1#2{%
-\special{pdf:literal /#1 cs /#1 CS #2 sc #2 SC}%
- \aftergroup\reset@color%
+ \special{pdf:literal /#1 cs /#1 CS #2 sc #2 SC}%
+ \aftergroup\reset@color%
}%
+\ifx\use@xcolor\undefined
\def\color@spotcolor#1#2{\c@lor@@spotcolor#2\@@#1}
\def\c@lor@@spotcolor#1,#2\@@#3{%
- \c@lor@arg{#2}%
- \edef#3{spot #1 #2}%
+ \c@lor@arg{#2}%
+ \edef#3{spot #1 #2}%
}
-\ifhks\input{spotcolorhks}\fi
-\ifpantone\input{spotcolorpantone}\fi
+\else
+\XC@sdef\XC@mod@spotcolor{spotcolor}
+\def\@@xespotcolordef@xspc#1,#2\@@{spot #1 #2}
+\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@{}{\@@xespotcolordef@xspc#5\@@}{spotcolor}{#5}}%
+ \else
+ \o@XC@definec@lor@xspc[#1]{#2}[#3]{#4}{#5}%
+ \fi
+}%
+\gdef\pgfsys@color@spotcolor@stroke#1#2{\special{pdf:literal /#1 CS #2 SC}}
+\gdef\pgfsys@color@spotcolor@fill#1#2{\special{pdf:literal /#1 cs #2 sc}}
+\gdef\pgfsys@color@spotcolor#1#2{\pgfsys@color@spotcolor@stroke{#1}{#2}%
+ \pgfsys@color@spotcolor@fill{#1}{#2}}
+\fi
+\ifx\use@hks\undefined\else\input{spotcolorhks}\fi
+\ifx\use@pantone\undefined\else\input{spotcolorpantone}\fi
\endinput
%%
%% End of file `xespotcolor.sty'.