How to draw A ⊕ B ⊕ C as a Venn diagram?

A PSTricks solution just for fun!

Answer 1

\documentclass[pstricks]{standalone}
\begin{document}
\begin{pspicture}(-5,-5)(5,5)
\pscustom[fillstyle=eofill,fillcolor=blue]
{ 
  \pscircle(1.5;90){3}
  \pscircle(1.5;-30){3} 
  \pscircle(1.5;210){3} 
} 
\end{pspicture} 
\end{document}

enter image description here

The stroke color is left black just for a trivial reason.

Cartesian coordinates are used in response to the request.

\documentclass[pstricks]{standalone}
\begin{document}
\begin{pspicture}(-5,-5)(5,5)
\pscustom[fillstyle=eofill,fillcolor=blue]
{ 
  \pscircle(0,1.5){3}
  \pscircle(1.29,-0.75){3} 
  \pscircle(-1.29,-0.75){3} 
} 
\end{pspicture} 
\end{document}

Answer 2

Non-zero winding rule:

\documentclass[pstricks,border=12pt]{standalone}
\begin{document}
\begin{pspicture}[showgrid=t](-3,-3)(3,3)
\pscustom[fillstyle=solid,fillcolor=red]
{
    \pscircle{1}
    \pscircle{2}
}
\end{pspicture} 
\end{document}

enter image description here

Non-zero winding rule:

\documentclass[pstricks,border=12pt]{standalone}
\begin{document}
\begin{pspicture}[showgrid=t](-3,-3)(3,3)
\pscustom[fillstyle=solid,fillcolor=red]
{
    \psarcn(0,0){1}{360}{0}
    \pscircle{2}
}
\end{pspicture} 
\end{document}

enter image description here

Even-odd rule:

\documentclass[pstricks,border=12pt]{standalone}
\begin{document}
\begin{pspicture}[showgrid=t](-3,-3)(3,3)
\pscustom[fillstyle=eofill,fillcolor=red]
{
    \pscircle{1}
    \pscircle{2}
}
\end{pspicture} 
\end{document}

enter image description here


Here is an answer based on the one by @Thomas. Differences

  • the "elementary" regions I, II, ..., VIII are not numbered the same. My numbering is that "N" is the Roman number of "n+1" where "n" in binary is "abc", and the region is intersection of A or not A with B or not B with C or not C according to a, b, c = 0 or 1. (Boolean logic)

  • the macro needs only one input: a TeX formula for the set. Please enrich the syntax by adding suitable definitions converting TeX math macros into Boolean logic notation, as understood by xintexpr

  • I have dropped all fancy customization of colors, but xparse virtuosos will add the fancy optional arguments to re-install it if needed.

Thus, the big point here is that xintexpr computes automatically from the TeX typesetting formula which regions are to be filled in diagram.

attention to \setminus it must be used either with parentheses \setminus (...) or without but then with only one letter \setminus A ok, \setminus A\cap B not ok, because the translation here to xintexpr boolean will do naively something equivalent to and not(A) and B, not the expected and not(A and B). In short, you must treat \setminus as having maximally tying precedence.

\documentclass[pstricks, border=10pt]{standalone}
\usepackage{pst-node}
\usepackage{xparse,xintexpr}

\def\KOEA{1.9,2.2}
\def\FOEA{1.4,1}

\def\KOEB{3.3,2.2}
\def\FOEB{1.2,1}

\def\KOEC{2.75,1.4}
\def\FOEC{1.4,1}

\def\KOEO{2.5,2}
\def\FOEO{2.5,2.0}

\NewDocumentCommand{\EreignisA}{sO{cyan}!O{0.8}}{%
\IfBooleanTF{#1}{%
\psellipse[fillstyle=solid,fillcolor=#2,opacity=#3](\KOEA)(\FOEA)}{%
\psellipse(\KOEA)(\FOEA)}%
}

\NewDocumentCommand{\EreignisB}{sO{cyan}!O{0.8}}{%
\IfBooleanTF{#1}{%
\psellipse[fillstyle=solid,fillcolor=#2,opacity=#3](\KOEB)(\FOEB)}{%
\psellipse(\KOEB)(\FOEB)}%
}

\NewDocumentCommand{\EreignisC}{sO{cyan}!O{0.8}}{%
\IfBooleanTF{#1}{%
\psellipse[fillstyle=solid,fillcolor=#2,opacity=#3](\KOEC)(\FOEC)}{%
\psellipse(\KOEC)(\FOEC)}%
}

\NewDocumentCommand{\EreignisOmega}{sO{cyan}!O{0.8}}{%
\IfBooleanTF{#1}{%
\psellipse[fillstyle=solid,fillcolor=#2,opacity=#3](\KOEO)(\FOEO)}{%
\psellipse(\KOEO)(\FOEO)}%
}

\NewDocumentCommand{\EndeEllipsen}{sm}{%
\EreignisOmega%
\pnodes(0.25,3.75){Omega}(0.25,0.25){A}(4.75,3.75){B}(4.75,0.25){C}(2.5,-0.5){E}
\pnodes(0.7,3.36){MOmega}(0.85,1.55){MA}(4,3){MB}(3.8,0.75){MC}
\EreignisA
\EreignisB
\EreignisC
\rput[t](E){#2}%
\IfBooleanF{#1}{%
\rput(Omega){$\Omega$}\pcline[nodesepA=0.25](Omega)(MOmega)
\rput(A){$A$}\pcline[nodesepA=0.25](A)(MA)
\rput(B){$B$}\pcline[nodesepA=0.25](B)(MB)
\rput(C){$C$}\pcline[nodesepA=0.2](C)(MC)
}%
}

\NewDocumentCommand{\codeclip}{m}{%
\pscustom[linestyle=none]{%
 \code{/clip /eoclip load def}%
  \psframe(-\maxdimen,-\maxdimen)(\maxdimen,\maxdimen)
  #1
  }%
}

%\ExplSyntaxOn
% We could use some automated macro creation but well
% 000
\NewDocumentCommand{\arealI}{O{cyan}!O{0.8}}{%
\psclip{%
\codeclip{%
  \EreignisA
}%
\codeclip{%
  \EreignisB
}%
\codeclip{%
  \EreignisC
}%
}%
\EreignisOmega*[#1][#2]%
\endpsclip
}%
% 001
\NewDocumentCommand{\arealII}{O{cyan}!O{0.8}}{%
\psclip{%
\codeclip{%
  \EreignisA
}%
\codeclip{%
  \EreignisB
}%
}%
\EreignisC*[#1][#2]%
\endpsclip
}
% 010
\NewDocumentCommand{\arealIII}{O{cyan}!O{0.8}}{%
\psclip{%
\codeclip{%
  \EreignisA
}%
\codeclip{%
  \EreignisC
}%
}%
\EreignisB*[#1][#2]%
\endpsclip
}
% 011
\NewDocumentCommand{\arealIV}{O{cyan}!O{0.8}}{%
\psclip{%
\codeclip{%
  \EreignisB
  \EreignisC
}%
\codeclip{%
  \EreignisA
}%
}%
\EreignisB*[#1][#2]%
\EreignisC*[#1][#2]%
\endpsclip
}
% 100
\NewDocumentCommand{\arealV}{O{cyan}!O{0.8}}{%
\psclip{%
\codeclip{%
  \EreignisB
}%
\codeclip{%
  \EreignisC
}%
}%
\EreignisA*[#1][#2]%
\endpsclip
}
% 101
\NewDocumentCommand{\arealVI}{O{cyan}!O{0.8}}{%
\psclip{%
\codeclip{%
  \EreignisA
  \EreignisC
}%
\codeclip{%
  \EreignisB
}%
}%
\EreignisA*[#1][#2]%
\EreignisC*[#1][#2]%
\endpsclip
}
% 110
\NewDocumentCommand{\arealVII}{O{cyan}!O{0.8}}{%
\psclip{%
\codeclip{%
  \EreignisA
  \EreignisB
}%
\codeclip{%
  \EreignisC
}%
}%
\EreignisA*[#1][#2]%
\EreignisB*[#1][#2]%
\endpsclip
}
% 111
\NewDocumentCommand{\arealVIII}{O{cyan}!O{0.8}}{%
\psclip{%
\codeclip{%
  \EreignisA
  \EreignisB
}%
\codeclip{%
  \EreignisA
  \EreignisC
}%
\codeclip{%
  \EreignisB
  \EreignisC
}%
}%
\EreignisA*[#1][#2]%
\EreignisB*[#1][#2]%
\EreignisC*[#1][#2]%
\endpsclip
}
%\ExplSyntaxOff

%\xintverbosetrue
\makeatletter
\newcommand\VennFromTeX[1]{%
    \VennFromTeX@main #1%
}%
\def\VennFromTeX@main$#1${%
    \begingroup
        \xintglobaldefstrue
        \def\overline##1{!(##1)}% or not(##1)
        \def\cap{&&}% or 'and'
        \def\cup{||}% or 'or'
        \def\oplus{ 'xor' }%
        \def\setminus##1{\ifx(##1&&!(\else &&!(##1)\fi}%
        \let\bigl\empty
        \let\bigr\empty
        % ....
        % (add above all needed extra definitions: \let\Bigl\empty etc...) 
    \xintdeffunc MyBool(A, B, C) := #1;% #1 must use A, B, C only
    \endgroup
    % we could make a loop here (using \@Roman), but let's stay simple
    % I trust xparse experts can wrap this up in macros allowing to customize
    % the colors
% ATTENTION THAT THESE \arealI...VIII ARE NOT THE SAME AS IN @THOMAS ANSWER
    \xintifboolexpr{MyBool(0, 0, 0)}{\arealI[cyan][0.8]}{}%
    \xintifboolexpr{MyBool(0, 0, 1)}{\arealII[cyan][0.8]}{}%
    \xintifboolexpr{MyBool(0, 1, 0)}{\arealIII[cyan][0.8]}{}%
    \xintifboolexpr{MyBool(0, 1, 1)}{\arealIV[cyan][0.8]}{}%
    \xintifboolexpr{MyBool(1, 0, 0)}{\arealV[cyan][0.8]}{}%
    \xintifboolexpr{MyBool(1, 0, 1)}{\arealVI[cyan][0.8]}{}%
    \xintifboolexpr{MyBool(1, 1, 0)}{\arealVII[cyan][0.8]}{}%
    \xintifboolexpr{MyBool(1, 1, 1)}{\arealVIII[cyan][0.8]}{}%
    \EndeEllipsen{$#1$}%
}%
\makeatother

\begin{document}

%testing if I, II, ..., VIII are as expected
% \makeatletter
% \xintFor*#1in{\xintSeq{0}{7}}\do{%
% \begin{pspicture}(0,-1)(5,4)
% \rput(2,0){\the\numexpr1+#1}
% \@nameuse{areal\@Roman{\numexpr1+#1}}[cyan][0.8]
% \EndeEllipsen{}
% \end{pspicture}
% }%
% \end{document}


\begin{pspicture}(0,-1)(5,4)
\VennFromTeX{$A\cap B\cap C$}%
\end{pspicture}

\begin{pspicture}(0,-1)(5,4)
\VennFromTeX{$A\cap (B\cup C)$}
\end{pspicture}

\begin{pspicture}(0,-1)(5,4)
\VennFromTeX{$(\overline{A}\cap \overline{B})\cup C$}
\end{pspicture}

\begin{pspicture}(0,-1)(5,4)
\VennFromTeX{$\overline{A}\setminus (B\cap C)$}
\end{pspicture}

\begin{pspicture}(0,-1)(5,4)
\VennFromTeX{$(\overline{A}\setminus B)\cap C$}
\end{pspicture}

\begin{pspicture}(0,-1)(5,4)
\VennFromTeX{$(A\setminus B)\cup (B\cap C)$}
\end{pspicture}

\begin{pspicture}(0,-1)(5,4)
\VennFromTeX{$\bigl((A\cap B)\cup (A\cap C)\bigr)\setminus(A\cap B\cap C)$}
\end{pspicture}

\begin{pspicture}(0,-1)(5,4)
\VennFromTeX{$A\oplus B\oplus C$}
\end{pspicture}

\end{document}

Produces

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here



Here is code to generate all 256 Venn diagrams. Just insert it in body of above document and don't forget to add \usepackage{xintbinhex} to preamble.

% generating all graphics

% 0<= n <= 255 has eight binary digits
% abcdefgh
% a=1 -> region VIII is included (A cap B cap C)
% b=1 -> region VII is included
% ...
% h=1 -> region I is included (\overline{A}\cap \overline{B} \cap \overline{C})
% We want also to describe the region as a formula...
% We could use 8 \xintFor loops #1, ..., #8, but then
% we still need to convert #1*7 to binary, #2*6, #3*5 etc...
% I thus use xintbinhex per convenience but \ifodd would be enough
% As I use xintbinhex, I also use a single \xintFor* loop

%\def\gobbleone#1{}%
\def\gobbletwo#1#2{}%
\xintFor* #1 in {\xintSeq{0}{255}}:
{%
   \xintDigitsOf\xintDecToBin{\the\numexpr256+#1\relax}\to\Regions
   % due to leading 1 there will be a shift of indexing in \Regions
   \edef\x{\xintifboolexpr{\Regions{\the\numexpr9-0}}% 000
              {\unexpanded{\allowbreak\cup
                           \overline{A}\cap\overline{B}\cap\overline{C}}}%
              {}%
           \xintifboolexpr{\Regions{9-1}}%  001
              {\unexpanded{\allowbreak\cup \overline{A}\cap\overline{B}\cap C}}%
              {}%
           \xintifboolexpr{\Regions{9-2}}%  010
              {\unexpanded{\allowbreak\cup \overline{A}\cap B \cap\overline{C}}}%
              {}%
           \xintifboolexpr{\Regions{9-3}}% 011
              {\unexpanded{\allowbreak\cup \overline{A} \cap B \cap C}}%
              {}%
           \xintifboolexpr{\Regions{9-4}}% 100
              {\unexpanded{\allowbreak\cup A\cap \overline{B}\cap \overline{C}}}%
              {}%
           \xintifboolexpr{\Regions{9-5}}% 101
              {\unexpanded{\allowbreak\cup A\cap \overline{B}\cap C}}%
              {}%
           \xintifboolexpr{\Regions{9-6}}% 110
              {\unexpanded{\allowbreak\cup A\cap B\cap \overline{C}}}%
              {}%
           \xintifboolexpr{\Regions{9-7}}% 111
              {\unexpanded{\allowbreak\cup A\cap B \cap C}}%
              {}%
    }%
   \xintifForFirst{\def\x{\emptyset}}
                  {\oodef\x{\expandafter\gobbletwo\x}}%
   \begin{pspicture}(0,-2)(5,4)
   % I will leave here each Region as individual call, so a color can
   % be added by modifying this code
    \xintifboolexpr{\Regions{9-0}}{\arealI[cyan][0.8]}{}%
    \xintifboolexpr{\Regions{9-1}}{\arealII[cyan][0.8]}{}%
    \xintifboolexpr{\Regions{9-2}}{\arealIII[cyan][0.8]}{}%
    \xintifboolexpr{\Regions{9-3}}{\arealIV[cyan][0.8]}{}%
    \xintifboolexpr{\Regions{9-4}}{\arealV[cyan][0.8]}{}%
    \xintifboolexpr{\Regions{9-5}}{\arealVI[cyan][0.8]}{}%
    \xintifboolexpr{\Regions{9-6}}{\arealVII[cyan][0.8]}{}%
    \xintifboolexpr{\Regions{9-7}}{\arealVIII[cyan][0.8]}{}%
    \EndeEllipsen{\parbox{4cm}{\centering$\x$}}%
   \end{pspicture}%
}%

Defect: the description of the set is as a disjoint union of atomic events. There might be some canonical shorter description but I never really thought about it. For example one of those diagram will represent $\Omega\setminus A$ but this not the way it will be legended.

Here is how this example comes out (on page 16 of document with nothing else, i.e. it corresponds to #1 = 15 in the loop, 15=1111 means to keep atomic events 0=000, 1=001, 2=010, 3=011, which is complement of A in Omega.

enter image description here



Here is now with 4 sets.

This time, with TikZ code (I know neither PSTricks nor TikZ and can only survive from copying pre-existing drawing instructions; in this case I started from https://tex.stackexchange.com/a/100091/4686 by @JohnHammersley in 2013).

First I include an image of all atomic events, which are the regions to which the \Atomic... macros in code next refer. (this was done for checking while preparing answer)

enter image description here

Here is the code for \VennFromTeX, use it as \VennFromTeX{$ set formula with A, B, C, D $}. Same instructions as above for three sets. (one may wish to enlarge the syntax for example by allowing use of U or \Omega and defining it in xintexpr to be simply 1, and similarly \emptyset could be defined to be 0).

\documentclass[12pt, tikz, border=10pt]{standalone}

\usepackage{tikz} 

\usetikzlibrary{positioning,shapes.geometric}

\usepackage{xintexpr}% for \VennFromTeX


% For drawing
\def\firstellip{(-1.6, 0) ellipse [x radius=3cm, y radius=1.5cm, rotate=-50]}
\def\secondellip{(-0.3, 1cm) ellipse [x radius=3cm, y radius=1.5cm, rotate=-50]}
\def\thirdellip{(0.3, 1cm) ellipse [x radius=3cm, y radius=1.5cm, rotate=50]}
\def\fourthellip{(1.6, 0) ellipse [x radius=3cm, y radius=1.5cm, rotate=50]}

\def\bounding{(-5,-3) rectangle (5,4)}

% Elementary sets
% ABCD
% abcd a, b, c, d in {0, 1}
\def\Atomic{% 0000
        \begin{scope}[even odd rule]% exterior
            \clip \firstellip (-5,-5) rectangle (5,5);
            \clip \secondellip (-5,-5) rectangle (5,5);
            \clip \thirdellip (-5,-5) rectangle (5,5);
            \clip \fourthellip (-5,-5) rectangle (5,5);
        \fill[yellow] \bounding;
        \end{scope}
}%
\def\Atomici{% 0001
        \begin{scope}[even odd rule]% fourth ellipse corner
            \clip \firstellip (-5,-5) rectangle (5,5);
            \clip \secondellip (-5,-5) rectangle (5,5);
            \clip \thirdellip (-5,-5) rectangle (5,5);
        \fill[yellow] \fourthellip;
        \end{scope}
}%
\def\Atomicii{% 0010
        \begin{scope}[even odd rule]% third ellipse corner
            \clip \firstellip (-5,-5) rectangle (5,5);
            \clip \secondellip (-5,-5) rectangle (5,5);
            \clip \fourthellip (-5,-5) rectangle (5,5);
        \fill[yellow] \thirdellip;
        \end{scope}
}%
\def\Atomiciii{% 0011
        \begin{scope}[even odd rule]%
            \clip \firstellip (-5,-5) rectangle (5,5);
            \clip \secondellip (-5,-5) rectangle (5,5);
            \clip \fourthellip;
        \fill[yellow] \thirdellip;
        \end{scope}
}%
\def\Atomiciv{% 0100
        \begin{scope}[even odd rule]% second ellipse corner
            \clip \firstellip (-5,-5) rectangle (5,5);
            \clip \thirdellip (-5,-5) rectangle (5,5);
            \clip \fourthellip (-5,-5) rectangle (5,5);
        \fill[yellow] \secondellip;
        \end{scope}
}%
\def\Atomicv{% 0101
        \begin{scope}[even odd rule]%
            \clip \firstellip (-5,-5) rectangle (5,5);
            \clip \thirdellip (-5,-5) rectangle (5,5);
            \clip \fourthellip;
        \fill[yellow] \secondellip;
        \end{scope}
}%
\def\Atomicvi{% 0110
        \begin{scope}[even odd rule]%
            \clip \firstellip (-5,-5) rectangle (5,5);
            \clip \thirdellip;
            \clip \fourthellip (-5,-5) rectangle (5,5);
        \fill[yellow] \secondellip;
        \end{scope}
}%
\def\Atomicvii{% 0111
        \begin{scope}[even odd rule]%
            \clip \firstellip (-5,-5) rectangle (5,5);
            \clip \thirdellip;
            \clip \fourthellip;
        \fill[yellow] \secondellip;
        \end{scope}
}%
\def\Atomicviii{% 1000
        \begin{scope}[even odd rule]%
            \clip \secondellip (-5,-5) rectangle (5,5);
            \clip \thirdellip (-5,-5) rectangle (5,5);
            \clip \fourthellip (-5,-5) rectangle (5,5);
        \fill[yellow] \firstellip;
        \end{scope}
}%
\def\Atomicix{% 1001
        \begin{scope}[even odd rule]%
            \clip \secondellip (-5,-5) rectangle (5,5);
            \clip \thirdellip (-5,-5) rectangle (5,5);
            \clip \fourthellip;
        \fill[yellow] \firstellip;
        \end{scope}
}%
\def\Atomicx{% 1010
        \begin{scope}[even odd rule]%
            \clip \secondellip (-5,-5) rectangle (5,5);
            \clip \thirdellip;
            \clip \fourthellip (-5,-5) rectangle (5,5);
        \fill[yellow] \firstellip;
        \end{scope}
}%
\def\Atomicxi{% 1011
        \begin{scope}[even odd rule]%
            \clip \secondellip (-5,-5) rectangle (5,5);
            \clip \thirdellip;
            \clip \fourthellip;
        \fill[yellow] \firstellip;
        \end{scope}
}%
\def\Atomicxii{% 1100
        \begin{scope}[even odd rule]%
            \clip \secondellip;
            \clip \thirdellip (-5,-5) rectangle (5,5);
            \clip \fourthellip (-5,-5) rectangle (5,5);
        \fill[yellow] \firstellip;
        \end{scope}
}%
\def\Atomicxiii{% 1101
        \begin{scope}[even odd rule]%
            \clip \secondellip;
            \clip \thirdellip (-5,-5) rectangle (5,5);
            \clip \fourthellip;
        \fill[yellow] \firstellip;
        \end{scope}
}%
\def\Atomicxiv{% 1110
        \begin{scope}[even odd rule]%
            \clip \secondellip;
            \clip \thirdellip;
            \clip \fourthellip (-5,-5) rectangle (5,5);
        \fill[yellow] \firstellip;
        \end{scope}
}%
\def\Atomicxv{% 1111
        \begin{scope}[even odd rule]%
            \clip \secondellip;
            \clip \thirdellip;
            \clip \fourthellip;
        \fill[yellow] \firstellip;
        \end{scope}
}%

\makeatletter
\newcommand\VennFromTeX[1]{\VennFromTeX@main #1}%

\def\VennFromTeX@main$#1${%
    \begingroup
        \xintglobaldefstrue
        \def\overline##1{!(##1)}% or not(##1)
        \def\cap{&&}% or 'and'
        \def\cup{||}% or 'or'
        \def\oplus{ 'xor' }%
        \def\setminus##1{\ifx(##1&&!(\else &&!(##1)\fi}%
        \let\bigl\empty
        \let\bigr\empty
        % ....
        % (add above all needed extra definitions: \let\Bigl\empty etc...) 
    \xintdeffunc MyBool(A, B, C, D) := #1;% #1 must use A, B, C, Donly
    \endgroup
    \begin{tikzpicture}

    \xintFor* ##1 in {01}:
    {%
      \xintFor* ##2 in {01}:
      {%
        \xintFor* ##3 in {01}:
        {%
          \xintFor* ##4 in {01}:
          {%
             \xintifboolexpr{MyBool(##1, ##2, ##3, ##4)}
             {\csname
               Atomic\romannumeral\numexpr##1*8+##2*4+##3*2+##4\endcsname}%
             {}%
           }%
         }%
       }%
    }%
    \draw \bounding;

    % \fill[white] \firstellip;
    % \fill[white] \secondellip;
    % \fill[white] \thirdellip;
    % \fill[white] \fourthellip;

    \draw \firstellip node [label={[xshift=-2cm, yshift=-0.9cm]$A$}] {};
    \draw \secondellip node [label={[xshift=-2.1cm, yshift=2.1cm]$B$}] {};
    \draw \thirdellip node [label={[xshift=2.1cm, yshift=2.1cm]$C$}] {};
    \draw \fourthellip node [label={[xshift=2cm, yshift=-0.9cm]$D$}] {};

    \draw \bounding node [label=below left:$U$] {};

    \draw (0, 0) node [yshift=+4.4cm] {$#1$};

    \end{tikzpicture}
}%
\makeatother
\begin{document}

% \xintverbosetrue

\VennFromTeX{$A\cap B\cap C\cap D$}

\VennFromTeX{$(A\cap B)\cup (C\cap D)$}

\VennFromTeX{$(\overline{A}\cup\overline{B})\cap(\overline{C}\cup\overline{D})$}

% attention to use parentheses for disambiguating \setminus 

\VennFromTeX{$(A\cup B \cup C) \setminus(B\cup C\cup D)$}

\VennFromTeX{$(A\cup B \cup C) \cap (B\cup C\cup D)$}

\VennFromTeX{$((A\setminus (B\cup C\cup D)) \cup B\cap C\cap
  D)\setminus (A\cap B\cap C\cap D)$}

\end{document}

Be careful to read the caveat top regarding usage of \setminus in input.

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

and finally

enter image description here


\documentclass[pstricks]{standalone}
\begin{document}
\begin{pspicture}(-5,-5)(5,5)
  \pscustom[fillstyle=eofill,fillcolor=blue,linecolor=blue]{% 
    \pscircle(1.5;90){3}
    \pscircle(1.5;-30){3} 
    \pscircle(1.5;210){3} 
} 
\end{pspicture} 
\end{document}

enter image description here

Some other simple example:

\documentclass[pstricks]{standalone}
\usepackage{pstricks}
\begin{document}
\begin{pspicture}(-3.2,-3.2)(3.2,3.2)
  \pscircle[fillstyle=solid,fillcolor=blue!40](0,0){3}
  \psclip{\pscircle(-1,0.5){1.5}% these object(s) will clip
          \pscircle(1,0.5){1.5}}
    \pscircle[fillstyle=solid,fillcolor=red!40](0,-1){1.5}% from this object
  \endpsclip
  \pscircle(-1,0.5){1.5}% to get the clipped circle lines
  \pscircle(0,-1){1.5}
  \pscircle(1,0.5){1.5}
\end{pspicture}

\begin{pspicture}(-3.2,-3.2)(3.2,3.2)
  \pscircle[fillstyle=solid,fillcolor=blue!40](0,0){3}
  \psclip{\pscircle(-1,0.5){1.5}}
    \pscircle[fillstyle=solid,fillcolor=red!40](0,-1){1.5}
    \pscircle[fillstyle=solid,fillcolor=red!40](1,0.5){1.5}
  \endpsclip
  \pscircle(-1,0.5){1.5}
  \pscircle(0,-1){1.5}
  \pscircle(1,0.5){1.5}
\end{pspicture}

\begin{pspicture}(-3.2,-3.2)(3.2,3.2)
  \pscircle[fillstyle=solid,fillcolor=blue!40](0,0){3}
  \psclip{\pscircle(0,-1){1.5}}
    \pscircle[fillstyle=solid,fillcolor=red!40](-1,0.5){1.5}
    \pscircle[fillstyle=solid,fillcolor=red!40](1,0.5){1.5}
  \endpsclip
  \pscircle(-1,0.5){1.5}
  \pscircle(0,-1){1.5}
  \pscircle(1,0.5){1.5}
\end{pspicture}

\begin{pspicture}(-3.2,-3.2)(3.2,3.2)
  \pscircle[fillstyle=solid,fillcolor=blue!40](0,0){3}
  \psclip{\pscircle(0,-1){1.5}}
    \pscircle[fillstyle=solid,fillcolor=red!40](1,0.5){1.5}
  \endpsclip
  \pscircle[fillstyle=solid,fillcolor=red!40](-1,0.5){1.5}
  \pscircle(0,-1){1.5}
  \pscircle(1,0.5){1.5}
\end{pspicture}

\end{document}

enter image description here enter image description here

Tags:

Color

Pstricks