I have not used the venndiagram package before. I have tried to read the manual, but could not find an answer to how to make the universal set box fit for any number of elements.
Here is what I have so far:
\documentclass{book}
\usepackage{newfile}
\usepackage{amsmath}
\usepackage{xifthen}
\usepackage{enumitem}
\usepackage{multicol}
\usepackage{lipsum}
\usepackage{multirow}
\usepackage{blindtext}
\usepackage{amsfonts}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{makecell}
\usepackage{cancel}
\usepackage{tikz}
\usetikzlibrary{tikzmark,shapes.misc}
\usepackage{venndiagram}
\usetikzlibrary{fit}
\usepackage[left=2.00cm, right=1.00cm, top=3.00cm, bottom=3.00cm]{geometry}
\usepackage{cellspace}
%------------------------------------
%-----------------------------------
\renewcommand\theadfont{\bfseries}
\usepackage{verbatim}
%\usepackage[active,tightpage]{preview}
%\PreviewEnvironment{tikzpicture}
%\setlength\PreviewBorder{5pt}%
\def\firstcircle{(0,0) circle (1.5cm)}
\def\secondcircle{(0:2cm) circle (1.5cm)}
\colorlet{circle edge}{blue!50}
\colorlet{circle area}{blue!20}
\tikzset{filled/.style={fill=circle area, draw=circle edge, thick},
outline/.style={draw=circle edge, thick}}
\setlength{\parskip}{5mm}
\begin{document}
\chapter{Sets and Venn Diagrams}
\section{Sets}
A set is a specific group of numbers or items from a list. The items in this set (the list list), are called Elements.\
Sets can be written in a few different ways - eg the set $A$ can be written as, $A={1,8,27,64}$, $A={Cube : numbers <100}$ and $A={x:x :is :a :cube :number :less :than :100}$
\section{Set Notiation}
If we take the natural numbers, $\mathbb{N} \leq10$
\begin{tabular}{|c|c|c|c|}
\hline
Sybmol & Name & Example & Explanation\
\hline
${}$ & Set & \thead{$A={1,3}$ \ $B={2,3,9}$ \ $C={3,9}$} & Collection of objects or items\
\hline
$\cap$ & intersect & $A \cap B = {3}$ & 3 belongs to both sets $A$ and $B$ \
\hline
$\cup$ & Union & $A \cup B = {1,2,3,9}$ & The elements belong to both $A$ and $B$ \
\hline
$\xi$ & The universal set & $\xi=\ {4,5,6,7,8,10}$ & All the elements not in the sets \
\hline
$\subset$ & Proper subset & \thead{${1} \cup A$ \ $C \cup B$} & A set is contained in another set \
\hline
$\subseteq$ &Subest & $\thead{B \subseteq A \ {1,3}}$ & A set that is contained in or equal to another set\
\hline
$\not \subseteq$ & Not a proper subset & ${1,3}$ & A set the is not contained in another set \
\hline
$\supset$ & Superset & $B \supset C$ & Set $B$ includes set $C$\
\hline
$\epsilon$ & is a member of & $3 \epsilon A$ & $3$ is in the set $A$\
\hline
$\not\epsilon$ & is not a member of & $4 \not\epsilon A $ & $4$ is not in the set $A $\
\hline
\end{tabular}
%--------------------------Problem code is here------------------%
my attempt
\begin{venndiagram3sets}[labelOnlyA={1},labelOnlyB= {2},labelOnlyC={}, labelOnlyAB={},labelOnlyAC={},labelOnlyBC= {9},labelABC={3}, labelNotABC={4,5,6,7,8,10}]
\end{venndiagram3sets} %My Attempt
%------------------------------------%
First suggestion
\begin{venndiagram3sets}[
labelOnlyA={1},
labelOnlyB={2},
labelOnlyC={},
labelOnlyAB= {},
labelOnlyAC={},
labelOnlyBC={9},
labelABC={3},
labelNotABC={4,5,6,7,8,10},
showframe=false,
]
\setpostvennhook{
\node[below left] at (venn top right) {(\mathcal{E})};
\node[fit=(venn top right) (venn bottom left) (labelNotABC),draw] {};
}
\end{venndiagram3sets} % second attempt
%--------------------------------------------%
Second suggestion
\fbox{\begin{venndiagram3sets}[showframe=false,labelOnlyA= {1},labelOnlyB={2},labelOnlyC={}, labelOnlyAB= {},labelOnlyAC= {},labelOnlyBC={9},labelABC={3}, labelNotABC={$\xi$ \ {4,5,6,7,8,10}}]
\end{venndiagram3sets}} %third attempt
%-----------And ends here----------------------------------%
%Diagrams
\section{diagrams}
% Definition of circles
\begin{tabular}{cc}
% Set A and B
\begin{tikzpicture}
\begin{scope}
\clip \firstcircle;
\fill[filled] \secondcircle;
\end{scope}
\draw[outline] \firstcircle node {$A$};
\draw[outline] \secondcircle node {$B$};
\node[anchor=south] at (current bounding box.north) {$A \cap B$};
\end{tikzpicture}
&
%Set A or B but not (A and B) also known a A xor B
\begin{tikzpicture}
\draw[filled, even odd rule] \firstcircle node {$A$}
\secondcircle node{$B$};
\node[anchor=south] at (current bounding box.north) {$\overline{A \cap B}$};
\end{tikzpicture}
% Set A or B
\begin{tikzpicture}
\draw[filled] \firstcircle node {$A$}
\secondcircle node {$B$};
\node[anchor=south] at (current bounding box.north) {$A \cup B$};
\end{tikzpicture}\
% Set A but not B
\begin{tikzpicture}
\begin{scope}
\clip \firstcircle;
\draw[filled, even odd rule] \firstcircle node {$A$}
\secondcircle;
\end{scope}
\draw[outline] \firstcircle
\secondcircle node {$B$};
\node[anchor=south] at (current bounding box.north) {$A - B$};
\end{tikzpicture}
&
% Set B but not A
\begin{tikzpicture}
\begin{scope}
\clip \secondcircle;
\draw[filled, even odd rule] \firstcircle
\secondcircle node {$B$};
\end{scope}
\draw[outline] \firstcircle node {$A$}
\secondcircle;
\node[anchor=south] at (current bounding box.north) {$B - A$};
\end{tikzpicture}\
\end{tabular}
\end{document}
I have edited this to provide all the code for my page incase anything is causing my problems. sorry for the long code.



$\xi$ \{4,5,6,7,8,10\}is inside the square? – samcarter_is_at_topanswers.xyz Aug 08 '22 at 16:41tikztwice and it is unclear to me why you define some circles which you don't use later. – Jasper Habicht Aug 08 '22 at 16:52