0

I have a document with two tables when I run the code separately they both work but when I run them together the top sections do not render and I cannot figure out why.

\documentclass{book}

\usepackage{newfile}
\usepackage{amsmath}
\usepackage{xifthen}
\usepackage{enumitem}
\usepackage{multicol}
\usepackage{lipsum}

\usepackage{blindtext}

\usepackage{tikz}% added <<<<<<<<<<<<<<<<<
\usepackage{verbatim}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{5pt}%

\usepackage[left=1.00cm, right=1.00cm, top=3.00cm, bottom=3.00cm]{geometry}

\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}

 \begin{tabular}{|c|c|}
 \hline
$x \in A$ & $x \:is \:an \:element \:of \:A$ \\
$n(A)$ & $the \:number \:of \:elements \:in \:A$ \\
$\xi$ & $the \:universal \:set$(the set containing all the elements) \\
$A \cup B$ & $the \:union \:of \:sets \:A \:and \:B$ (all the elements in either set) \\
$A \cap B$ & $the \:intersection \:of \:sets \:A \:and \:B$ (all elements in both sets) \\
$A'$ & $the \:complement \:of \:set \:A$ (all elements not in set A) \\
\hline
\end{tabular}


%---------------------------------------------%

%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}

any help or hint would be welcome.

9
  • The second instance of \begin{tabular} is missing the directive's mandatory part: the column specifications. Compare this to the first instance: \begin{tabular}{|c|c|}. Admittedly, the LaTeX error message that's issued following the blank \begin{tabular} statement -- ! LaTeX Error: Illegal character in array arg. -- could be a tad more informative.
    – Mico
    Aug 6 at 9:47
  • Thank you @Mico I have altered the code that was silly of me but now it just renders 5 blank pages. Is it because my document class is book? and I need to and additional code?
    – Paul A
    Aug 6 at 14:23
  • You get 5 blank pages with the code posted above? I get 5 small pages each with a labeled Venn diagram. Could you post your .log file somewhere like a pastebin site and link to it here?
    – frabjous
    Aug 6 at 15:17
  • 1
    I also get to 5 pages of Venn diagrams when I compile your code. That's because your preamble features the following three instructions: \usepackage[active,tightpage]{preview} \PreviewEnvironment{tikzpicture} \setlength\PreviewBorder{5pt}. Do remove (or comment out) these instructions if you want to see the full document.
    – Mico
    Aug 6 at 16:29
  • 4
    I’m voting to close this question because the OP reports having managed to solve the main problems, albeit through measures not explained in sufficient detail for others to follow.
    – Mico
    Aug 6 at 17:15

0

Browse other questions tagged or ask your own question.