summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/pstricks/pstricks.sty
blob: 36014b1d9b79a5059a131ae605d33dde01ff65c4 (plain)
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
% $Id: pstricks.sty 872 2018-12-21 20:39:31Z herbert $
%%
%% This is file `pstricks.sty'.
%%
%% IMPORTANT NOTICE:
%%
%% pstricks.sty Copyright (C) 1997 Timothy Van Zandt
%% pstcol.sty   Copyright (C) 1994-1996 1999 David Carlisle
%% pstricks.sty Copyright (C) 2004-     Rolf Niepraschk <Rolf.Niepraschk@gmx.de>
%%                                      Herbert Voss <hvoss@tug.org>
%%                            2019-     Herbert Voss <hvoss@tug.org>
%%
%% This package may be distributed under the terms of the LaTeX Project
%% Public License, as described in lppl.txt in the base LaTeX distribution.
%% Either version 1.0 or, at your option, any later version.
%%

\NeedsTeXFormat{LaTeX2e}

\ProvidesPackage{pstricks}[2018/12/21 v0.69 LaTeX wrapper for `PSTricks' (RN,HV)]
% 
\def\documentclass{%
  \edef\@tempa{\jobname.tex }%
  \edef\@tempb{\@filef@und}%
  \@onelevel@sanitize\@tempa
  \@onelevel@sanitize\@tempb
  \ifx\@tempa\@tempb
    \@latex@error
      {`\jobname.tex' is a forbidden name for your document,\MessageBreak
      it is already a name of a package}%
      {Choose another name for your document}\@gobble
  \else
    \@twoclasseserror
  \fi
}
% 
\def\pst@ColorPackage{xcolor}
\DeclareOption{noxcolor}{\def\pst@ColorPackage{color}}
%
\newif\ifpst@psfonts  \pst@psfontsfalse
\newif\if@check@engine  \@check@enginetrue 
\newif\ifpst@xetex  \pst@xetexfalse

\DeclareOption{psfonts}{\pst@psfontstrue}
\DeclareOption{noEngineCheck}{\@check@enginefalse}
\DeclareOption{xetex}{\global\pst@xetextrue}
%
%---------------------------------DISTILLER --------------------------------
\newif\ifpst@distiller\pst@distillerfalse
\DeclareOption{distiller}{\pst@distillertrue\pst@psfontstrue}
%
%---------------------------------COLOR --------------------------------
\DeclareOption{monochrome}{%
  \AtBeginDocument{\special{ps:
   true setglobal globaldict begin
    /setrgbcolor { add add 0 gt {1}{0} ifelse setgray } def 
    /setcmykcolor{ 4 dict begin
      /k ED /y ED /m ED /c ED 
      1 1 k sub c mul k add sub 0.29 mul 
      1 1 k sub m mul k add sub 0.587 mul add 
      1 1 k sub y mul k add sub 0.114 mul add
      end 0 gt {1}{0} ifelse setgray } def 
   end false setglobal }}}

\DeclareOption{grayscale}{%
  \AtBeginDocument{\special{ps:
   true setglobal globaldict begin
    /setrgbcolor { 0.07 mul exch 0.71 mul add exch 0.21 mul add setgray } def 
    /setcmykcolor{ 4 dict begin
      /k ED /y ED /m ED /c ED 
      1 1 k sub c mul k add sub 0.29 mul 
      1 1 k sub m mul k add sub 0.587 mul add 
      1 1 k sub y mul k add sub 0.114 mul add
      end setgray } def 
    end false setglobal }}}

\DeclareOption*{\PassOptionsToPackage\CurrentOption{\pst@ColorPackage}}
\ProcessOptions\relax


\RequirePackage{iftex}
\RequirePackage{shellesc}
%\ifPDFTeX
%  \ifpdfshellescape\else
%        \@latex@error
%    {You are running `\jobname.tex' with pdflatex and without option `--shell-escape' ,\MessageBreak
%    	you need package auto-pst-pdf and that option!}%
%    {Alternatively use xelatex or latex->dvips->ps2pdf}
%  \fi
%\fi
\RequirePackage{\pst@ColorPackage}
%
\@ifundefined{PSTricksLoaded}
{%
  \let\saved@scalebox\scalebox
  \input{pst-xkey}%
  \input{pstricks}%
  \ProvidesFile{pstricks.tex}[\filedate\space v\fileversion\space `PSTricks' (tvz,hv)]
  \input{pst-fp.tex}%
  \ProvidesFile{pst-fp.tex}[\filedate\space v\fileversion\space `PST-fp' (hv)]
  \IfFileExists{pstricks.pro}{%
    \ProvidesFile{pstricks.pro}
      [2018/11/14 v. 1.29,  PostScript prologue file (hv)]
        \@addtofilelist{pstricks.pro}}{}%
  \IfFileExists{pst-algparser.pro}{%
    \ProvidesFile{pst-algparser.pro}[2011/10/31 v. 0.04,  PostScript prologue file (hv)]
        \@addtofilelist{pst-algparser.pro}}{}%
  \IfFileExists{pst-tools.pro}{%
    \ProvidesFile{pst-tools.pro}[2012/01/01 v. 0.02,  PostScript prologue file (hv)]
        \@addtofilelist{pst-tools.pro}}{}%
  \IfFileExists{pst-dots.pro}{%
    \ProvidesFile{pst-dots.pro}[2006/12/19 v. 2.00,  PostScript prologue file (hv)]
        \@addtofilelist{pst-dots.pro}}{}%
}{}
%
\ifpst@distiller
  \pst@def{setTransparency}<
    [ /ca \psk@opacityalpha 
      /CA \psk@opacityalpha /SetTransparency pdfmark >
  \pst@def{setStrokeTransparency}<
    [ /ca \psk@strokeopacityalpha 
      /CA \psk@strokeopacityalpha /SetTransparency pdfmark >
  \pst@def{setBlendmode}<
    [ /BM%
     \ifcase\psk@blendmode
      /Normal \or
      /Compatible \or
      /Screen \or
      /Multiply \or
      /HardLight \or
      /Darken \or
      /Lighten \or
      /Difference \or
      /ColorDodge \or
      /ColorBurn \or
      /SoftLight \or
      /Hue \or
      /Saturation \or
      /Luminosity \or
      /Overlay \or
      /Exclusion \or
      /Color
    \else 
      /Normal 
    \fi
    /ca \psk@shapealpha /CA \psk@opacityalpha /SetTransparency pdfmark >
\fi
%
\@ifpackageloaded{xcolor}{%
  \@ifpackagelater{xcolor}{2004/05/02}%
  {%
    \let\pst@getcolor\XC@getcolor
    \let\pst@usecolor\XC@usecolor
  }
  {%
    \PackageError{pstricks}{%
    *************************************************\MessageBreak
    * Your Version of `xcolor.sty' is too old!\MessageBreak
    * You need the version from 2004/05/02 or newer\MessageBreak
    * or use: \string\usepackage[noxcolor]{pstricks}\MessageBreak
    *************************************************}{}%
  }%
}{%
  \def\pst@getcolor#1#2{%
    \@ifundefined{\string\color@#1}%
    {\@pstrickserr{Color `#1' not defined}\@eha}%
    {\edef#2{#1}}}%
  \def\pst@usecolor#1{\expandafter\expandafter\expandafter\c@lor@to@ps%
    \csname\string\color@#1\endcsname\@@\space}%
  \definecolor{darkgray}{gray}{.25}
  \definecolor{gray}{gray}{.5}
  \definecolor{lightgray}{gray}{.75}
}%
%
\definecolor{gradbegin}{rgb}{0,1,1}
\definecolor{gradend}{rgb}{0,.1,.95}
%
\@ifundefined{xglobal}%
 {\def\xglobal#1#2#3#4% UK 2005-11-17
   {#1{#2}{#3}{#4}%
    \expandafter\global\expandafter\let\csname\string\color@#2%
    \expandafter\endcsname\csname\string\color@#2\endcsname}}{}%
%
\def\newgray#1{%
  \expandafter\gdef\csname #1\endcsname{\color{#1}}%  HV 2004-03-31
  \xglobal\definecolor{#1}{gray}}%
%
\def\newrgbcolor#1#2{%
  \expandafter\gdef\csname #1\endcsname{\color{#1}}%  HV 2004-03-31
  \edef\@tempa{\noexpand\newrgbcolorx{#1}#2\noexpand\@@}\@tempa}%
\def\newrgbcolorx#1#2 #3 #4\@@{%
  \xglobal\definecolor{#1}{rgb}{#2,#3,#4}}
%
\def\newcmykcolor#1#2{%
  \expandafter\gdef\csname #1\endcsname{\color{#1}}%  HV 2004-03-31
  \edef\@tempa{\noexpand\newcmykcolorx{#1}#2\noexpand\@@}\@tempa}
\def\newcmykcolorx#1#2 #3 #4 #5\@@{%
  \xglobal\definecolor{#1}{cmyk}{#2,#3,#4,#5}}
%
\def\newhsbcolor#1#2{%
  \expandafter\gdef\csname #1\endcsname{\color{#1}}%  HV 2004-03-31
  \edef\@tempa{\noexpand\newhsbcolorx{#1}#2\noexpand\@@}\@tempa}
\def\newhsbcolorx#1#2 #3 #4\@@{%
  \xglobal\definecolor{#1}{hsb}{#2,#3,#4}}
%
\definecolor{black}{gray}{0}
\definecolor{darkgray}{gray}{.25}
\definecolor{gray}{gray}{.5}
\definecolor{lightgray}{gray}{.75}
\definecolor{white}{gray}{1}
\definecolor{red}{rgb}{1,0,0}
\definecolor{green}{rgb}{0,1,0}
\definecolor{blue}{rgb}{0,0,1}
%\definecolor{yellow}{rgb}{1,1,0}
%\definecolor{cyan}{rgb}{0,1,1}
%\definecolor{magenta}{rgb}{1,0,1}
\definecolor{yellow}{cmyk}{0,0,1,0}
\definecolor{cyan}{cmyk}{1,0,0,0}
\definecolor{magenta}{cmyk}{0,1,0,0}
%
\renewcommand*\black{\color{black}}
\renewcommand*\darkgray{\color{darkgray}}
\renewcommand*\gray{\color{gray}}
\renewcommand*\lightgray{\color{lightgray}}
\renewcommand*\white{\color{white}}
\renewcommand*\blue{\color{blue}}
\renewcommand*\red{\color{red}}
\renewcommand*\green{\color{green}}
\renewcommand*\yellow{\color{yellow}}
\renewcommand*\magenta{\color{magenta}}
\renewcommand*\cyan{\color{cyan}}
%
\AtBeginDocument{%
%  \psset{fillcolor=white}%      hv 0.33
  \let\pst@endcolor=\relax%
%  \let\pst@color=\relax%
% LaTeX used `\color@endgroup' instead. RN 2004-05-06
}
\pst@cntm=0
\ifXeTeX\pst@cntm=1\else\ifpst@xetex\pst@cntm=1\fi\fi

\ifnum\pst@cntm>\z@
  \typeout{>>> Loading XeTeX special macros}%
  \input{pstricks-xetex.def}%
\fi
%
%% End of file `pstricks.sty'.