summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/pst-venn/pst-venn.sty
blob: ef07a1b89ee5edcc9039ff73446a5acad30c3ee1 (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
%% $Id: pst-venn.sty 848 2018-12-04 09:25:49Z herbert $
%%
%% This is file `pst-venn.sty',
%%
%% This program can be redistributed and/or modified under the terms
%% of the LaTeX Project Public License Distributed from CTAN archives
%% in directory macros/latex/base/lppl.txt.
%%
%% Herbert Voss <hvoss _at_ tug.org (Germany)
%%
%% DESCRIPTION:
%% `pst-venn' is a package for Venn diagrams
%
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{pstricks}
\RequirePackage{pst-xkey}
%
\def\filedate{2018/12/04}
\def\fileversion{0.01}
\ProvidesPackage{pst-venn}[\filedate\ v\fileversion\ drawing Venn diagrams (hv)]
%
\pst@addfams{pst-venn}
\define@key[psset]{pst-venn}{bgradius}[3]{\def\psVenn@bgradius{#1}}
\define@key[psset]{pst-venn}{bgcolor}[blue!40]{\def\psVenn@bgcolor{#1}}
\define@key[psset]{pst-venn}{fgcolor}[red!40]{\def\psVenn@fgcolor{#1}}
\define@key[psset]{pst-venn}{vennfill}[solid]{\def\psVenn@fillstyle{#1}}
\define@boolkey[psset]{pst-venn}[Pst@]{bgcircle}[true]{}

\psset[pst-venn]{bgcircle,bgradius=3,bgcolor=blue!40,fgcolor=red!40,vennfill=solid}

\def\psVenn{\pst@object{psVenn}}
\def\psVenn@i(#1)(#2)(#3)#4#5{%
  \begingroup
  \use@par  
  \ifPst@bgcircle\pscircle[fillstyle=solid,fillcolor=\psVenn@bgcolor](0,0){\psVenn@bgradius}\fi
  \psVenn@ii(#1)(#2)(#3){#4}#5\@nil
  \pscircle(#1){#4}% to get the clipped circle lines
  \pscircle(#2){#4}
  \pscircle(#3){#4}
  \endgroup
}
\def\psVenn@ii(#1)(#2)(#3)#4#5#6\@nil{%
  \ifcase#5 
	\or %1
	  \psclip[clipcommand=eoclip]{%
	    \pscustom[linestyle=none]{%
		  \psframe(-\maxdimen,-\maxdimen)(\maxdimen,\maxdimen)
		  \pscircle(#2){#4}\pscircle(#3){#4}}%
	    \pscustom[linestyle=none]{%
		  \psframe(-\maxdimen,-\maxdimen)(\maxdimen,\maxdimen)
		  \pscircle(#3){#4}}%
      }%
        \pscircle[fillstyle=\psVenn@fillstyle,fillcolor=\psVenn@fgcolor](#1){#4}
      \endpsclip
  \or %2
      \psclip[clipcommand=eoclip]{%
      	\pscustom[linestyle=none]{%
      		\psframe(-\maxdimen,-\maxdimen)(\maxdimen,\maxdimen)
      		\pscircle(#1){#4}\pscircle(#3){#4}}%
      	\pscustom[linestyle=none]{%
      		\psframe(-\maxdimen,-\maxdimen)(\maxdimen,\maxdimen)
      		\pscircle(#3){#4}}%
      }%
      \pscircle[fillstyle=\psVenn@fillstyle,fillcolor=\psVenn@fgcolor](#2){#4}
      \endpsclip
 	\or %3
	  \psclip[clipcommand=eoclip]{%
  	    \pscustom[linestyle=none]{%
		  \psframe(-\maxdimen,-\maxdimen)(\maxdimen,\maxdimen)
		  \pscircle(#1){#4}\pscircle(#2){#4}
	    }%
	    \pscustom[linestyle=none]{%
		  \psframe(-\maxdimen,-\maxdimen)(\maxdimen,\maxdimen)
		  \pscircle(#2){#4}
	    }%
      }%
        \pscircle[fillstyle=\psVenn@fillstyle,fillcolor=\psVenn@fgcolor](#3){#4}
      \endpsclip
	\or %4
	    \psclip[clipcommand=eoclip]{%
	  	\pscustom[linestyle=none]{%
	  		\psframe(-3,-3)(3,3)
	  		\pscircle(#1){#4}\pscircle(#3){#4}}%
	  	\pscustom[linestyle=none]{%
	  		\psframe(-\maxdimen,-\maxdimen)(\maxdimen,\maxdimen)
	  		\pscircle(#2){#4}}%
	  }%
	  \pscircle[fillstyle=\psVenn@fillstyle,fillcolor=\psVenn@fgcolor](#3){#4}
	  \endpsclip
	\or %5
        \psclip[clipcommand=eoclip]{%
        	\pscustom[linestyle=none]{%
        		\psframe(-3,-3)(3,3)
        		\pscircle(#1){#4}\pscircle(#2){#4}}%
        	\pscustom[linestyle=none]{%
        		\psframe(-\maxdimen,-\maxdimen)(\maxdimen,\maxdimen)
        		\pscircle(#3){#4}}%
        }%
        \pscircle[fillstyle=\psVenn@fillstyle,fillcolor=\psVenn@fgcolor](#1){#4}
        \endpsclip        
	\or %6
	  \psclip[clipcommand=eoclip]{%
		\pscustom[linestyle=none]{%
			\psframe(-3,-3)(3,3)
			\pscircle(#2){#4}\pscircle(#3){#4}}%
		\pscustom[linestyle=none]{%
			\psframe(-\maxdimen,-\maxdimen)(\maxdimen,\maxdimen)
			\pscircle(#1){#4}}%
	}%
	\pscircle[fillstyle=\psVenn@fillstyle,fillcolor=\psVenn@fgcolor](#2){#4}
	\endpsclip
	\or %7
	  \psclip{\pscircle(#1){#4}\pscircle(#3){#4}}
 	    \pscircle[fillstyle=\psVenn@fillstyle,fillcolor=\psVenn@fgcolor](#2){#4}
	  \endpsclip
	\else
	\fi
  \ifx\relax#6\relax \def\next{}\else\def\next{\psVenn@ii(#1)(#2)(#3){#4}#6\@nil}\fi
  \next
}

\endinput