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/xetex/latex/xespotcolor/README | 13 + macros/xetex/latex/xespotcolor/jatestspot.pdf | Bin 0 -> 66609 bytes macros/xetex/latex/xespotcolor/jatestspot.tex | 53 +++ macros/xetex/latex/xespotcolor/spotcolor-test.pdf | Bin 0 -> 4841 bytes macros/xetex/latex/xespotcolor/spotcolor-test.tex | 32 ++ macros/xetex/latex/xespotcolor/xespotcolor.dtx | 387 ++++++++++++++++++++++ macros/xetex/latex/xespotcolor/xespotcolor.ins | 54 +++ macros/xetex/latex/xespotcolor/xespotcolor.pdf | Bin 0 -> 76507 bytes 8 files changed, 539 insertions(+) create mode 100644 macros/xetex/latex/xespotcolor/README create mode 100644 macros/xetex/latex/xespotcolor/jatestspot.pdf create mode 100644 macros/xetex/latex/xespotcolor/jatestspot.tex create mode 100644 macros/xetex/latex/xespotcolor/spotcolor-test.pdf create mode 100644 macros/xetex/latex/xespotcolor/spotcolor-test.tex create mode 100644 macros/xetex/latex/xespotcolor/xespotcolor.dtx create mode 100644 macros/xetex/latex/xespotcolor/xespotcolor.ins create mode 100644 macros/xetex/latex/xespotcolor/xespotcolor.pdf (limited to 'macros/xetex/latex/xespotcolor') diff --git a/macros/xetex/latex/xespotcolor/README b/macros/xetex/latex/xespotcolor/README new file mode 100644 index 0000000000..3b34d1e477 --- /dev/null +++ b/macros/xetex/latex/xespotcolor/README @@ -0,0 +1,13 @@ +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 spotcolor package +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. Version 2.0a adds +support for the xcolor package and so one can use +spotcolors in TikZ pictures. + +Apostolos Syropoulos +2016/03/22 diff --git a/macros/xetex/latex/xespotcolor/jatestspot.pdf b/macros/xetex/latex/xespotcolor/jatestspot.pdf new file mode 100644 index 0000000000..c681db61f2 Binary files /dev/null and b/macros/xetex/latex/xespotcolor/jatestspot.pdf differ diff --git a/macros/xetex/latex/xespotcolor/jatestspot.tex b/macros/xetex/latex/xespotcolor/jatestspot.tex new file mode 100644 index 0000000000..92b301b37a --- /dev/null +++ b/macros/xetex/latex/xespotcolor/jatestspot.tex @@ -0,0 +1,53 @@ +% +% testspot.tex +% platex testspot.tex +% dvipdfmx testspot +% +\documentclass{jsarticle} +\usepackage[hks,pantone]{xespotcolor} +\begin{document} + \color{blue} + \bf\Huge カラーパッケージを用いた青いテキスト + + \clearpage + \pagecolor{white} + + \SetPageColorSpace{PANTONE} + \SpotColor{PANTONEGreenPC}{1.0} + \bf\Huge Pantone スポットカラー + + \clearpage + \SetPageColorSpace{HKS} + \SpotColor{HKS68N}{1.0} + \bf\Huge HKS スポットカラー + + \clearpage + \NewSpotColorSpace{SOMECOLORSPACE} + \AddSpotColor{SOMECOLORSPACE} {SOMECOLOR} {Spot\SpotSpace Color\SpotSpace Name\SpotSpace in\SpotSpace PDF} {0.5 1.0 0.51 0} + \SetPageColorSpace{SOMECOLORSPACE} + \definecolor{Spots}{spotcolor}{SOMECOLOR,1.0} + + \SpotColor{SOMECOLOR}{1.0} + \bf\Huge ここで定義したスポットカラー\\ + シェーディングも可能:\\ + \SpotColor{SOMECOLOR}{1.0}\rule{1cm}{1cm}\\ + \SpotColor{SOMECOLOR}{0.9}\rule{1cm}{1cm}\\ + \SpotColor{SOMECOLOR}{0.8}\rule{1cm}{1cm}\\ + \SpotColor{SOMECOLOR}{0.7}\rule{1cm}{1cm}\\ + \SpotColor{SOMECOLOR}{0.6}\rule{1cm}{1cm}\\ + \SpotColor{SOMECOLOR}{0.5}\rule{1cm}{1cm}\\ + \SpotColor{SOMECOLOR}{0.4}\rule{1cm}{1cm}\\ + \SpotColor{SOMECOLOR}{0.3}\rule{1cm}{1cm}\\ + \SpotColor{SOMECOLOR}{0.2}\rule{1cm}{1cm}\\ + \SpotColor{SOMECOLOR}{0.1}\rule{1cm}{1cm}\\ + \SpotColor{SOMECOLOR}{0.0}\rule{1cm}{1cm} + + \clearpage + \pagecolor{Spots} + \SpotColor{SOMECOLOR}{0.1} + 背景色としてのスポットカラー + + \clearpage + \pagecolor{white} + \colorbox{Spots}{日日日} +\end{document} diff --git a/macros/xetex/latex/xespotcolor/spotcolor-test.pdf b/macros/xetex/latex/xespotcolor/spotcolor-test.pdf new file mode 100644 index 0000000000..8e4de76e79 Binary files /dev/null and b/macros/xetex/latex/xespotcolor/spotcolor-test.pdf differ diff --git a/macros/xetex/latex/xespotcolor/spotcolor-test.tex b/macros/xetex/latex/xespotcolor/spotcolor-test.tex new file mode 100644 index 0000000000..8ae6277d3e --- /dev/null +++ b/macros/xetex/latex/xespotcolor/spotcolor-test.tex @@ -0,0 +1,32 @@ +\documentclass{minimal} +\usepackage{tikz} +\usepackage[xcolor]{xespotcolor} +\begin{document} + % First define a new color space + \NewSpotColorSpace{MyPantone} + % Now define real colors using http://www.pantone.com/color-finder + % The numbers are the CMYK representation. For example, the CMYK + % representation of PANTONE 383 CP is 29 1 100 18 that translatex to + % 0.29 0.01 1 0.18 + \AddSpotColor{MyPantone}{Blue}{Spot\SpotSpace Color\SpotSpace Blue}{0.92 0.24 0 0 } + \AddSpotColor{MyPantone}{Green}{Spot\SpotSpace Color\SpotSpace Green} {0.65 0 0.96 0 } + % Next we need to set the page color space + \SetPageColorSpace{MyPantone} + % Now we can define and use colors. Colors are defined as shades of a specific spot color. + \definecolor{AbsoluteBlue}{spotcolor}{Blue,1.0} + \pagecolor{AbsoluteBlue} %% Page color + \SpotColor{Green}{0.8} %% Color of letters + A spotcolor as background color. + \clearpage % Page 2 + This is some more text. %Text appears in black. + \clearpage % Page 3 + \pagecolor{white} + \colorbox{AbsoluteBlue}{Text in blue background} + \clearpage % Page 4 Tikz example + \definecolor{MyGreen}{spotcolor}{Green,0.5} + \definecolor{MyBlue}{spotcolor}{Blue,0.5} + \begin{tikzpicture} + \filldraw[color=MyGreen] (0.1,0.1) rectangle (1.9,0.9); + \draw[color=MyBlue, ultra thick] (0,0) rectangle (2,1); + \end{tikzpicture} +\end{document} diff --git a/macros/xetex/latex/xespotcolor/xespotcolor.dtx b/macros/xetex/latex/xespotcolor/xespotcolor.dtx new file mode 100644 index 0000000000..88cf2450ed --- /dev/null +++ b/macros/xetex/latex/xespotcolor/xespotcolor.dtx @@ -0,0 +1,387 @@ +%% \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 \~} +%% +%\iffalse +% +% (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 +% version 1.3c of the License, or any later version. +% +% This work has the LPPL maintenance status `maintained'. +% +% Please report errors or suggestions for improvement to +% +% Apostolos Syropoulos (asyropoulos@yahoo.com) +% +%\fi +% \CheckSum{184} +% \iffalse This is a Metacomment +% +%\ProvidesFile{xesporcolor.sty} +% +% [2016/03/22 v2.0a Package `xespotcolor.sty'] +% +% \begin{macrocode} +%<*driver> +\documentclass{ltxdoc} +\GetFileInfo{xspotcolor.drv} +\usepackage{xltxtra} +\usepackage{fullpage} +\begin{document} +\setmainfont[Mapping=tex-text,Script=Greek]{Arno Pro} +\setmonofont{UM Typewriter} +\setsansfont[Mapping=tex-text]{GFS Neohellenic} + \DocInput{xespotcolor.dtx} +\end{document} +% +% \end{macrocode} +% \fi +%\MakeShortVerb{\|} +%\StopEventually{} +%\title{The \textsf{xespotcolor} package:\\ Spot Colors for \XeLaTeX\ \&\ \LaTeX} +%\author{Απόστολος Συρόπουλος\\ +% (Apostolos Syropoulos)\\ +% Xanthi, Greece\\ +% \texttt{asyropoulos@yahoo.com}} +% \date{2016/03/22} +%\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. +%\end{abstract} +% +%\section{Introduction} +% +% Using spot colors with \XeLaTeX\ is very important since most printers use spot colors in the +% production of books and magazines. The \textsf{spotcolor} package makes it possible to use +% spot colors with pdf\LaTeX\ but it cannot be used with \XeLaTeX\ or \LaTeX. In what follows I first +% describe how to translate certain pdf\TeX\ code snippets into \XeTeX\ or \TeX+\texttt{dvipdfmx} +% and then I present the code of the package. Thus one can view this text as a short tutorial on how to port +% pdf\TeX\ code to \XeTeX\ or \TeX+\texttt{dvipdfmx} as well as a description of the functionality of the +% \textsf{xespotcolor} package. Since the package is a port of a pdf\TeX\ package, it has the same functionality +% as the original package. +% +% +% \section{Porting pdf\TeX\ code to \XeTeX\ or \TeX+\texttt{dvipdfmx}} +% +% Translating pdf\TeX\ code, which adds PDF code to the output file, to \XeTeX\ or \TeX+\texttt{dvipdfmx} is not a +% straightforward exercise since pdf\TeX\ provides primitive commands that directly access and modify the structure of +% the resulting PDF file. In the case of \XeTeX\ and \TeX\ one has to use |\special| commands that pass code to the driver. +% In this particular case, I had to translate code snippets like the following one: +% \begin{center} +% |1. \newcount\theCNTa |\\ +% |2. \newcount\theCNTb |\\ +% |3. \def\obj{ 0 R}% |\\ +% |4. \pdfobj{Raw PDF code 1}% |\\ +% |5. \theCNTa=\the\pdflastobj% |\\ +% |6. \pdfobj{Raw PDF code \the\theCNTa \obj}% |\\ +% |7. \theCNTb=\the\pdflastobj% |\\ +% |8. \pdfrefobj\theCNTa% |\\ +% |9. \pdfrefobj\theCNTb% |\\ +% \end{center} +% Here pdf\TeX\ creates two PDF objects, where the second contains a reference to the first one. The two counters +% defined in lines 1 and 2 are used to reference these two objects. The macro on line 3 is used to create code +% that references an object. The commands on lines 5 and 7 assign the object reference numbers and these numbers are +% used by the |\pdfrefobj| primitive. After some experimentation and some… Googling, I have found out that the following +% \XeTeX\ code is a reasonable translation of the previous code snipper: +% \begin{center} +% |\newcount\CNT |\\ +% |\newtoks\TOK |\\ +% |\TOK={@TOK \the\CNT}% |\\ +% |\edef\A{\the\TOK Raw PDF code 1}% |\\ +% |\edef\B{Raw PDF code \the\TOK}% |\\ +% |\special{pdf:obj \A}% |\\ +% |\special{pdf:obj @TOKB\the\CNT \B}% |\\ +% |\advance\CNT by1% |\\ +% \end{center} +% The two |\edef|initions are used to do the work done by |\pdfobj|. Note that here there I introduce only +% one unique object and the first two lines define a counter and a token variable. The token variable uses +% the counter to create a unique identifier, which is passed to the driver. This way the driver will +% create a number of different objects, if required to do so. The last two commands pass the raw PDF +% code and the unique identifier to the driver. +% +% The original package contains a definition identical to the following one: +% \begin{center} +% |\def\R#1{% |\\ +% | \edef\act{\noexpand\pdfpageresources={\the\pdfpageresources\space |\\ +% | /ColorSpace<<#1>>}} |\\ +% | \act} |\\ +% \end{center} +% The net effect of this command is to add a specific color space to the page resources of all subsequent pages. +% Unfortunately, when the following code is executed, it adds the particular color space to the current page only: +% \begin{center} +% |\def\R#1{% |\\ +% | \special{pdf:put @resources <>>>}}|\\ +% \end{center} +% In order to add the color space to all subsequent pages, I had to use the |\AddEverypageHook| command of +% package \textsf{everypage}. This command modifies the contents of the ship-out box by adding to it its argument. +% And this is done for every single page. Also, one should note how the page resources are augmented by the two +% systems. In the case of \XeTeX\ we have to create a PDF dictionary that is merged with the current page resources, +% while in the case of pdf\TeX\ one just ``appends'' what is supposed to be included in the page resources dictionary. +% Let me now proceed with the description of the source code of the package. +% +% \section{The Source Code and Package Usage} +% The first part of the code is the identification part. +% \begin{macrocode} +%<*xespotcolor> +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{xespotcolor} + [2016/03/22 v.2.0a, Package for adding Spot Color support to LaTeX/XeLaTeX.] +% \end{macrocode} +% 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 + \@ifpackageloaded{graphics}{}{\RequirePackage[xetex]{graphics}} + \@ifpackageloaded{color}{}\RequirePackage[xetex]{color} +\else + \@ifpackageloaded{graphics}{}{\RequirePackage[dvipdfmx]{graphics}} + \@ifpackageloaded{color}{}\RequirePackage{color} +\fi +\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 following command should be executed only when using \textsf{TikZ}. Thus, always load this +% package after loading package \textsf{TikZ}. +% \begin{macrocode} +\@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. +% \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: +% \begin{center} +%|\AddSpotColor{NEWCS}{NEWCOLOR}{emerald\SpotSpace city}{0.83 0 0.04 30}| +% \end{center} +% CMYK tables usually specify the four color components using percentages, which must be ``translated'' to +% numbers between 0 and 1. +% +% 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} +\catcode`\#=6% +% \end{macrocode} +%The macro |\csgrab| is quite unsual---it takes two arguments and creates a sequence of them. +% \begin{macrocode} +\gdef\csgrab#1#2{#2\expandafter{\the#2 #1}}% +% \end{macrocode} +%Note that this command should never be used by an ordinary package user. +% +% The following variables are used in the definition of macro |\AddSpotColor|. Their functionality has been +% described in the previous section. +% \begin{macrocode} +\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. +% \begin{macrocode} +\def\AddSpotColor#1#2#3#4{% + \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 + <>}% + \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}% +% \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. +% \begin{macrocode} + \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. +% \begin{macrocode} + \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 the |\AddEverypageHook| +% command provided by the \textsf{everypage} package. +% \begin{macrocode} +\def\SetPageColorResource#1{% + \AddEverypageHook{\special{pdf:put @resources <>>>}}% +}% +\def\SetPageColorSpace#1{% + \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% +}% +% \end{macrocode} +% 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 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 new color space, a new spot color using commands like the following ones: +%\begin{center} +%\begin{tabular}{l} +%|\NewSpotColorSpace{SPCOLORSPACE}|\\ +%|\AddSpotColor{SPCOLORSPACE}{SPCOLOR}{Some\SpotSpace Name}{0.5 1.0 0.51 0}|\\ +%|\SetPageColorSpace{SPCOLORSPACE}|\\ +%\end{tabular} +%\end{center} +% Note that we must set the page color space! +% +% 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}% +} +% \end{macrocode} +% 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} +\ifx\use@hks\undefined\else\input{spotcolorhks}\fi +\ifx\use@pantone\undefined\else\input{spotcolorpantone}\fi +% +% \end{macrocode} +% \Finale +% \section{Simple Usage Example} +% The code that follows shows how one should use the package to create color drawings using Tikz. +% \begin{flushleft} +% |% First define a new color space|\\ +% |\NewSpotColorSpace{MyPantone}|\\ +% |% Now define real colors|\\ +% |\AddSpotColor{MyPantone}{Blue}{Spot\SpotSpace Color\SpotSpace Blue}{0.92 0.24 0 0}|\\ +% |\AddSpotColor{MyPantone}{Green}{Spot\SpotSpace Color\SpotSpace Green} {0.65 0 0.96 0}|\\ +% |% Next we need to set the page color space|\\ +% |\SetPageColorSpace{MyPantone}|\\ +% |% Finally we can define colors!|\\ +% |\definecolor{MyGreen}{spotcolor}{Green,0.5}|\\ +% |\definecolor{MyBlue}{spotcolor}{Blue,0.5}|\\ +% |% And this how we use these colors in drawings.|\\ +% |\begin{tikzpicture}|\\ +% | \filldraw[color=MyGreen] (0.1,0.1) rectangle (1.9,0.9);|\\ +% | \draw[color=MyBlue, ultra thick] (0,0) rectangle (2,1);|\\ +% |\end{tikzpicture}|\\ +% \end{flushleft} +% \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/macros/xetex/latex/xespotcolor/xespotcolor.ins b/macros/xetex/latex/xespotcolor/xespotcolor.ins new file mode 100644 index 0000000000..87a72bfb1f --- /dev/null +++ b/macros/xetex/latex/xespotcolor/xespotcolor.ins @@ -0,0 +1,54 @@ +%% Copyright 2014-2016 Apostolos Syropoulos +%% +%% This file is part of the `xespotcolor' package. +%% You are not allowed to modify its contents. +%% +\def\filedate{2016/03/22} +\def\batchfile{xespotcolor.ins} +\input docstrip.tex + +{\ifx\generate\undefined +\Msg{**********************************************} +\Msg{*} +\Msg{* This installation requires docstrip} +\Msg{* version 2.3c or later.} +\Msg{*} +\Msg{* An older version of docstrip has been input} +\Msg{*} +\Msg{**********************************************} +\errhelp{Move or rename old docstrip.tex.} +\errmessage{Old docstrip in input path} +\batchmode +\csname @@end\endcsname +\fi} + +\preamble + + (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 + version 1.3c of the License, or any later version. + + This work has the LPPL maintenance status `maintained'. + + Please report errors or suggestions for improvement to + + Apostolos Syropoulos (asyropoulos@yahoo.com) + + +\endpreamble + + +\keepsilent + +\generate{\generateFile{xespotcolor.sty}{f}{\from{xespotcolor.dtx}{xespotcolor}}} +\postamble +\endpostamble +\Msg{**********************************************************} +\Msg{* To finish installation you have to copy} +\Msg{* the generated .sty file in the appropriate} +\Msg{* directory and then to rehash your TeX system} +\Msg{* Happy XeTeXing!} +\Msg{**********************************************************} +\endinput diff --git a/macros/xetex/latex/xespotcolor/xespotcolor.pdf b/macros/xetex/latex/xespotcolor/xespotcolor.pdf new file mode 100644 index 0000000000..6df553415e Binary files /dev/null and b/macros/xetex/latex/xespotcolor/xespotcolor.pdf differ -- cgit v1.2.3