3

I would like to draw six figures in a single page, in order to explain inclusion and intersection of sets.

I thought of 3 rows, 2 figures per each row. I'm trying the following way:

\documentclass{preamble}

\begin{document}
\pagestyle{empty}

\newcommand{\circumference}[3]{(#1,#2) circle (#3cm)}

\begin{table}[h] \centering
\begin{tabular}{cc}

\begin{tikzpicture}

\draw \circumference{0}{0}{1.5} node [below left]{$A$};
\draw \circumference{0}{0}{3} node [above right] at (2.1,2.4){$B$};
\draw node at (0,-4) {$A \contained B \equiv \forall x [A(x) \to B(x)]$};

\end{tikzpicture}

&

\begin{tikzpicture}

\draw \circumference{7}{-1.5}{1.5} node [left] {$A$};
\draw \circumference{9}{-1.5}{1.5} node [right] {$B$};
\draw [fill] \circumference{8}{-1.5}{0.025};
\draw node at (8,-4) {$A \between B \equiv \exists x [A(x) \land B(x)]$};

\end{tikzpicture}

\\

\begin{tikzpicture}

\draw \circumference{0}{-1}{1.5} node [left] {$A$};
\draw \circumference{2}{-1}{1.5} node [right] {$B$};
\draw \circumference{1}{-1}{2};
\draw node at (1,-4) {$A \cap B \contained C \equiv \forall x [A(x) \land B(x) \to C(x)]$};

\end{tikzpicture}

&

$ \forall x [A(x) \lor B(x) \contained C(x)]$

\end{tabular}
\end{table}
\end{document}

Here I haven't completed on purpose, for I'd like to know if this is the best way to do it. Shall I use other environments or treat diagrams as figures, so that I can label them with their corrispondent formula? Also, are there more elegant ways for what I'm doing?

Thanks. Any suggestion will be useful.

EDIT I made the following changes:

\documentclass{preamble}

\begin{document}
\pagestyle{empty}

\def\radius{1.5}

\newcommand{\ellipse}[4]{(#1,#2) ellipse (#3cm and #4cm)}
\newcommand{\circumference}[3]{(#1,#2) circle (#3cm)}

\begin{figure}[h] \centering \captionsetup[subfigure]{labelformat=empty} 
\begin{tabular}{cc}
\subfloat[{$A \subseteq B \equiv \forall x [A(x) \to B(x)]$}]{\begin{tikzpicture}

\draw \circumference{0}{0}{\radius} node at (45:2) {$A$};
\draw \ellipse{0}{0}{3}{2} node at (45:2.8) {$B$};

\end{tikzpicture}
}
&
\subfloat[{$A \between B \equiv \exists x [A(x) \land B(x)]$}]{

\begin{tikzpicture}

\draw \circumference{-1}{0}{\radius} node at (150:2.7) {$A$};
\draw \circumference{1}{0}{\radius} node at (30:2.7) {$B$};
\draw [fill] \circumference{0}{0}{0.025};

\end{tikzpicture}
}

\\

\subfloat[{$A \cap B \subseteq C \equiv \forall x [A(x) \land B(x) \to C(x)]$}]{
\begin{tikzpicture}
\draw \circumference{-1}{0}{\radius} node at (150:2.7) {$A$};
\draw \circumference{1}{0}{\radius} node at (30:2.7) {$B$};
\draw \ellipse{0}{0}{1}{2} node at (63:2.1) {$C$};
\end{tikzpicture}
}

&

\subfloat[{$ A \cup B \subseteq C \equiv \forall x [A(x) \lor B(x) \to C(x)]$}]{
\begin{tikzpicture}
\draw \circumference{-1}{0}{\radius} node at (150:2.6) {$A$};
\draw \circumference{1}{0}{\radius} node at (30:2.6) {$B$};
\draw \ellipse{0}{0}{3}{2.5} node at (63:2.8) {$C$};
\end{tikzpicture}
}

\\

\subfloat[{$ A \subseteq B \cup C \equiv \forall x [A(x) \to B(x) \lor C(x)] $}]{
\begin{tikzpicture}
\draw \circumference{-1}{0}{\radius} node at (150:2.7) {$B$};
\draw \circumference{1}{0}{\radius} node at (30:2.7) {$C$};
\draw \ellipse{0}{0}{1.5}{0.8} node at (45:1.4) {$A$};
\end{tikzpicture}
}

&

\subfloat[{$ A \subseteq B \cap C \equiv \forall x [A(x) \to B(x) \land C(x)]$}]{
\begin{tikzpicture}
\draw \circumference{-1}{0}{\radius} node at (150:2.7) {$B$};
\draw \circumference{1}{0}{\radius} node at (30:2.7) {$C$};
\draw \ellipse{0}{0}{0.35}{0.65} node at (92:0.835) {$A$};
\end{tikzpicture}
}


\end{tabular}
\end{figure}


\end{document}

I'm wondering if there is any optimal solution for the following issues:

  • I'd like to label sets with letters A,B,C outside circles and ellipse automatically, with a suitable distance from the border of a set.

  • The ellipses are now slightly different. Is there any way to fix them?

  • Are my newcommands \circumference and \ellipse actually useful? Is there any better option?

In summary, I think this is not the right way to write a code. Can you help me?

I tried definying commands such as

\def\firstcircle{(0,0) circle (1.5cm)}
\def\secondcircle{(0:2cm) circle (1.5cm)}

or

% some coordinates for the center of the circles
\coordinate (ceni);
\coordinate[xshift=\radius] (cenii);

% the circles
\draw (ceni) circle (\radius);
\draw (cenii) circle (\radius);

but I really can't come up with anything. Also, I can't find any documentation about (ceni). What is it for?

Where is it best to put the coordinate (0,0)?

Finally, I can I copy-paste easily my code, so that I don't have to add 4 spaces " " to visualize it?

1
  • Finally, I can I copy-paste easily my code, so that I don't have to add 4 spaces " " to visualize it? select the code, and press the {} button or the key combination Ctrl-K (for Kode...)
    – Thruston
    Jul 24, 2018 at 22:12

1 Answer 1

1

I think that there is a chance that your question may be considered "primarily opinion based". Anyway, here is how I would probably do it. The idea to use a tabular is great, but perhaps it is reasonable to use subfigures for its cells, and to put the mathematical relations in subcaptions rather than nodes of the tikzpictures. And there are already quite a few questions and answers on Venn diagrams on this site, so you may just get inspired by those.

\documentclass{article} % I do not have preamble.cls
\usepackage{tikz}
\newcommand{\contained}{\ensuremath{\supset}} % <- I made this up
\newcommand{\between}{\ensuremath{\in}} % <- I made this up

\usepackage{subfig}
\begin{document}
\pagestyle{empty}

\newcommand{\circumference}[3]{(#1,#2) circle (#3cm)}

\begin{figure}[h] \centering
\begin{tabular}{cc}
\subfloat[{$A \contained B \equiv \forall x [A(x) \to B(x)]$}]{\begin{tikzpicture}

\draw \circumference{0}{0}{1.5} node [below left]{$A$};
\draw \circumference{0}{0}{3} node [above right] at (2.1,2.4){$B$};
%\draw node at (0,-4) {};

\end{tikzpicture}
}
&
\subfloat[{$A \between B \equiv \exists x [A(x) \land B(x)]$}]{\begin{tikzpicture}

\draw \circumference{7}{-1.5}{1.5} node [left] {$A$};
\draw \circumference{9}{-1.5}{1.5} node [right] {$B$};
\draw [fill] \circumference{8}{-1.5}{0.025};
%\draw node at (8,-4) {$A \between B \equiv \exists x [A(x) \land B(x)]$};

\end{tikzpicture}}
\\
\subfloat[{$A \cap B \contained C \equiv \forall x [A(x) \land B(x) \to C(x)]$}]{\begin{tikzpicture}
\draw \circumference{0}{-1}{1.5} node [left] {$A$};
\draw \circumference{2}{-1}{1.5} node [right] {$B$};
\draw \circumference{1}{-1}{2};
%\draw node at (1,-4) {$A \cap B \contained C \equiv \forall x [A(x) \land B(x) \to C(x)]$};
\end{tikzpicture}}
&
\subfloat[{$ \forall x [A(x) \lor B(x) \contained C(x)]$}]{
}
\end{tabular}
\caption{Various Venn diagrams.}
\end{figure}
\end{document}

enter image description here

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .