1

It took me a while to figure out how to draw the following 2 sets Venn diagramm. So I am posting the code here in case it will make someone's hapiness.

\documentclass{article}
\usepackage{tikz}
\usepackage{caption}

\definecolor{airforceblue}{rgb}{0.36, 0.54, 0.66}
\definecolor{brightgreen}{rgb}{0.4, 1.0, 0.0}

\begin{document}

\begin{tikzpicture}
 
% Set J
\node [circle,
    fill=airforceblue,
        draw=orange,
        line width=2mm,
    minimum size =3cm,
    label={[label distance=0.1cm,orange,font=\Large]225:$J$}] (J) at (0,0){};

% Set K
\node [circle,
    fill=airforceblue,
        draw=brightgreen,
        line width=2mm,
    minimum size =3cm,
    label={[label distance=0.1cm,brightgreen,font=\Large]45:$K$}] (K) at (1.8,0){};
 
% Circles outline
\draw[orange,thick] (0,0) circle(1.5cm);
\draw[white,thick] (1.8,0) circle(1.5cm);
 
% Union text label
\node[airforceblue!90!black] at (0.9,1.8) {$J\cup K$};

% Intersection text label
\node at (0.9,0) {$J\cap K$};

% Complements text label
\node[left,white] at (J.center){$J \setminus K$};
\node[right,white] at (K.center){$K \setminus J$};
 
\end{tikzpicture}
%\captionof{figure}{Venn diagramms for union, intersection and complement}

\end{document}

I use inital code from here and personalised it.

3
  • What is the question?:-(
    – Sebastiano
    Feb 15, 2022 at 19:52
  • 1
    Following up on the previous comment: you need to split the post in two, one part as a question, for example: "below is the code from latexdraw.com, how do I add features x,y,z?" and another part as an answer: "you need to add such and such code, this is the explanation what this new code does and why you need it, and this is a screenshot of the results". The answer part needs to be posted as an actual answer (in the answer box), not as an edit to the question.
    – Marijn
    Feb 15, 2022 at 22:00
  • 4
    I’m voting to close this question because it needs to be changed into a self-answered Q&A pair.
    – Marijn
    Feb 21, 2022 at 13:01

0

Browse other questions tagged .