3

In the following table, I would like to center the Venn diagrams vertically. Here is a MWE showing my diagrams aligned "top":

\documentclass[letterpaper,10pt,american]{article}
\usepackage[left=1 in, right=1 in, top=1 in, bottom=1 in]{geometry}
\usepackage{amsmath,amsfonts,amssymb,amsthm,color,srcltx,hyperref,enumitem,bm,cancel,thmtools}
\usepackage[scr=boondoxo,scrscaled=1.05]{mathalfa}
\usepackage{centernot}
\usepackage{pgf,tikz}
\usetikzlibrary{automata,arrows,positioning,calc,decorations.pathreplacing}

%Command for creating Venn diagrams (from https://tex.stackexchange.com/questions/266326/generate-all-16-possible-2-variable-shaded-venn-diagrams-in-tikz):
\makeatletter
\def\venn@strip#1#2\venn@STOP{\def\venn@next{#1}\gdef\venn@rest{#2}}
\newcommand{\venn}[1]{%
\begin{tikzpicture}[scale=0.15]
\coordinate (A) at (2,0);
\coordinate (B) at (0,0);
\coordinate (E) at (5,-3);
\coordinate (W) at (-3,{sqrt(3)+1.5});
\edef\venn@rest{#10000}%
\foreach \i in {0,...,3} {
\begin{scope}[even odd rule]
\expandafter\venn@strip\venn@rest\venn@STOP
\ifnum\venn@next=1\relax
\pgfmathparse{Mod(\i,2) == 1 ? "(E) rectangle (W)" : ""}
\path[clip] \pgfmathresult (A) circle[radius=2];
\pgfmathparse{Mod(floor(\i/2),2) == 1 ? "(E) rectangle (W)" : ""}
\path[clip] \pgfmathresult (B) circle[radius=2];
\pgfmathparse{Mod(floor(\i/4),2) == 1 ? "(E) rectangle (W)" : ""}
\fill[gray] (E) rectangle (W);
\fi
\end{scope}
}
\draw[thick] (A) circle[radius=2];
\draw[thick] (B) circle[radius=2];
\draw[thick] (E) rectangle (W);
\end{tikzpicture}
}
\makeatother

\begin{document}
\begin{displaymath}
\begin{array}{|c|c|c|c|}
\hline
\textrm{Truth Table} & \textrm{Venn Diagram} & \textrm{Connective} & \textrm{Connective Name} \\
\hline
FFFF & \venn{0000} & \mathscr{P} \perp \mathscr{Q} & \textrm{Contradiction} \\
FFFT & \venn{0001} & \mathscr{P} \overline{\lor} \mathscr{Q} & \textrm{Nondisjunction (Nor)} \\
FFTF & \venn{0010} & \mathscr{P} \centernot\impliedby \mathscr{Q} & \textrm{Converse Nonimplication} \\
\hline
\end{array}
\end{displaymath}
\end{document}

I tried the raisebox method suggested in this question, and here is the MWE for that:

\documentclass[letterpaper,10pt,american]{article}
\usepackage[left=1 in, right=1 in, top=1 in, bottom=1 in]{geometry}
\usepackage{amsmath,amsfonts,amssymb,amsthm,color,srcltx,hyperref,enumitem,bm,cancel,thmtools}
\usepackage[scr=boondoxo,scrscaled=1.05]{mathalfa}
\usepackage{centernot}
\usepackage{pgf,tikz}
\usetikzlibrary{automata,arrows,positioning,calc,decorations.pathreplacing}

%Command for creating Venn diagrams (from https://tex.stackexchange.com/questions/266326/generate-all-16-possible-2-variable-shaded-venn-diagrams-in-tikz):
\makeatletter
\def\venn@strip#1#2\venn@STOP{\def\venn@next{#1}\gdef\venn@rest{#2}}
\newcommand{\venn}[1]{%
\begin{tikzpicture}[scale=0.15]
\coordinate (A) at (2,0);
\coordinate (B) at (0,0);
\coordinate (E) at (5,-3);
\coordinate (W) at (-3,{sqrt(3)+1.5});
\edef\venn@rest{#10000}%
\foreach \i in {0,...,3} {
\begin{scope}[even odd rule]
\expandafter\venn@strip\venn@rest\venn@STOP
\ifnum\venn@next=1\relax
\pgfmathparse{Mod(\i,2) == 1 ? "(E) rectangle (W)" : ""}
\path[clip] \pgfmathresult (A) circle[radius=2];
\pgfmathparse{Mod(floor(\i/2),2) == 1 ? "(E) rectangle (W)" : ""}
\path[clip] \pgfmathresult (B) circle[radius=2];
\pgfmathparse{Mod(floor(\i/4),2) == 1 ? "(E) rectangle (W)" : ""}
\fill[gray] (E) rectangle (W);
\fi
\end{scope}
}
\draw[thick] (A) circle[radius=2];
\draw[thick] (B) circle[radius=2];
\draw[thick] (E) rectangle (W);
\end{tikzpicture}
}
\makeatother

\begin{document}
\begin{displaymath}
\begin{array}{|c|c|c|c|}
\hline
\textrm{Truth Table} & \textrm{Venn Diagram} & \textrm{Connective} & \textrm{Connective Name} \\
\hline
FFFF & \raisebox{-.35\height}{\venn{0000} } & \mathscr{P} \perp \mathscr{Q} & \textrm{Contradiction} \\
FFFT & \raisebox{-.35\height}{\venn{0001} } & \mathscr{P} \overline{\lor} \mathscr{Q} & \textrm{Nondisjunction (Nor)} \\
FFTF & \raisebox{-.35\height}{\venn{0010} } & \mathscr{P} \centernot\impliedby \mathscr{Q} & \textrm{Converse Nonimplication} \\
\hline
\end{array}
\end{displaymath}
\end{document}

however, this seems to cause my diagrams to slide to the left, losing horizontal alignment! Hence I am looking for an alternative approach that can improve how this is turning out visually.

By the way, I am by no means committed to array, so if you have a different suggestion (like using tabular or tabularx or something else), I am definitely open to your ideas!

4

You can use baseline option to tikzpicture

\newcommand{\venn}[1]{%
\begin{tikzpicture}[scale=0.15,baseline={(current bounding box.center)}]

This will give

enter image description here

In your approach using \raisebox, you have an extra space before the closing brace:

\raisebox{-.35\height}{\venn{0010} }

which should be

\raisebox{-.35\height}{\venn{0010}}  %<-- no space here before }

Code:

\documentclass[letterpaper,10pt,american]{article}
\usepackage[left=1 in, right=1 in, top=1 in, bottom=1 in]{geometry}
\usepackage{amsmath,amsfonts,amssymb,amsthm,color,srcltx,hyperref,enumitem,bm,cancel,thmtools}
\usepackage[scr=boondoxo,scrscaled=1.05]{mathalfa}
\usepackage{centernot}
\usepackage{pgf,tikz}
\usetikzlibrary{automata,arrows,positioning,calc,decorations.pathreplacing}

%Command for creating Venn diagrams (from http://tex.stackexchange.com/questions/266326/generate-all-16-possible-2-variable-shaded-venn-diagrams-in-tikz):
\makeatletter
\def\venn@strip#1#2\venn@STOP{\def\venn@next{#1}\gdef\venn@rest{#2}}
\newcommand{\venn}[1]{%
\begin{tikzpicture}[scale=0.15]
\coordinate (A) at (2,0);
\coordinate (B) at (0,0);
\coordinate (E) at (5,-3);
\coordinate (W) at (-3,{sqrt(3)+1.5});
\edef\venn@rest{#10000}%
\foreach \i in {0,...,3} {
\begin{scope}[even odd rule]
\expandafter\venn@strip\venn@rest\venn@STOP
\ifnum\venn@next=1\relax
\pgfmathparse{Mod(\i,2) == 1 ? "(E) rectangle (W)" : ""}
\path[clip] \pgfmathresult (A) circle[radius=2];
\pgfmathparse{Mod(floor(\i/2),2) == 1 ? "(E) rectangle (W)" : ""}
\path[clip] \pgfmathresult (B) circle[radius=2];
\pgfmathparse{Mod(floor(\i/4),2) == 1 ? "(E) rectangle (W)" : ""}
\fill[gray] (E) rectangle (W);
\fi
\end{scope}
}
\draw[thick] (A) circle[radius=2];
\draw[thick] (B) circle[radius=2];
\draw[thick] (E) rectangle (W);
\end{tikzpicture}%
}
\makeatother

\begin{document}
\begin{displaymath}
\begin{array}{|c|c|c|c|}
\hline
\textrm{Truth Table} & \textrm{Venn Diagram} & \textrm{Connective} & \textrm{Connective Name} \\
\hline
FFFF & \raisebox{-.35\height}{\venn{0000}} & \mathscr{P} \perp \mathscr{Q} & \textrm{Contradiction} \\
FFFT & \raisebox{-.35\height}{\venn{0001}} & \mathscr{P} \overline{\lor} \mathscr{Q} & \textrm{Nondisjunction (Nor)} \\
FFTF & \raisebox{-.35\height}{\venn{0010}} & \mathscr{P} \centernot\impliedby \mathscr{Q} & \textrm{Converse Nonimplication} \\
\hline
\end{array}
\end{displaymath}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.