# What is the most efficient way to draw sets in LaTeX?

What is the best way to draw sets in LaTeX. I want to have a visualization of the Sets of a certain proof because it is way easier to see than to read. But I am not sure if it is worth the effort to draw it with something like tikz. Or if I should rather just draw it in paint and import a picture.

I just made a photo of the sketch I made on paper - it is kind of ugly (and also in german) but maybe it gives a better idea than my rambling

They are open sets which I would draw with dotted lines and the closure of these open sets is compact so I would draw it as a complete line. with every set including all the previous sets. (The goal is to get a partition of unity this way)

Would you recommend a quick and dirty solution or are there benefits in taking the time to actually draw it within LaTeX?

• Could you redraw the sets more clearly? – Money Oriented Programmer Dec 27 '18 at 23:02
• pst-venn for Venn diagrams and package venndiagramm – user31729 Dec 27 '18 at 23:02
• if you mean Venn diagrams, there are many options. The first two are already mentioned by @ChristianHupfer, more options (or maybe examples) are texample.net/tikz/examples/venn-diagram or responses to similar questions in the site – Luis Turcio Dec 28 '18 at 0:58

Unfortunately, your figure is next-to-unreadable. So the following may or may not be useful.

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{patterns}
\tikzset{% from https://tex.stackexchange.com/a/29367/121799
hatch distance/.store in=\hatchdistance,
hatch distance=10pt,
hatch thickness/.store in=\hatchthickness,
hatch thickness=2pt
}

\makeatletter
\pgfdeclarepatternformonly[\hatchdistance,\hatchthickness]{flexible hatch}
{\pgfqpoint{0pt}{0pt}}
{\pgfqpoint{\hatchdistance}{\hatchdistance}}
{\pgfpoint{\hatchdistance-1pt}{\hatchdistance-1pt}}%
{
\pgfsetcolor{\tikz@pattern@color}
\pgfsetlinewidth{\hatchthickness}
\pgfpathmoveto{\pgfqpoint{0pt}{0pt}}
\pgfpathlineto{\pgfqpoint{\hatchdistance}{\hatchdistance}}
\pgfusepath{stroke}
}
\makeatother

\begin{document}
\begin{tikzpicture}[elli/.style args={#1 and #2}{insert path={
(#1,0) arc (0:360:#1 and #2)}}]
\draw[green!60!black,pattern=north east lines,pattern color=green!60!black,
even odd rule,elli=3*1.25 and 2*1.25,elli=3 and 2] coordinate[pos=0.5] (x1)
coordinate[pos=0.6] (x2);
\draw[purple,pattern=flexible hatch,pattern color=purple,
even odd rule,elli=3*1.5 and 2*1.5,elli=3*0.75 and 2*0.75];
\draw[red,thick] (x1) circle (1.5 and 0.8);
\draw[red,thick,rotate=15] (x2) circle (1.5 and 0.8);
\end{tikzpicture}
\end{document}


As for the question whether or not one should learn drawing such figures with LateX: this is up to you. See e.g. this discussion for more thoughts.

• The cross hatching is blinding, making it difficult to make out the structure. Solid colours or smooth gradations are easier to look at. (But it does look like the picture you were given to imitate, so excellent work.) – Benjamin McKay Dec 28 '18 at 10:43