This document produces a table that mostly looks like I want it to look... except that I can't get the text in the left-hand column to be aligned in the vertical center. What I would really like is for the text in that column to be aligned vertically in the center, and horizontally on the left.
I looked for material about this stuff, but it all suggests that
- by default things will be top-aligned
- using the
arraypackage and specifying the column usingm{width}will yield a middle-aligned column.
Yet this doesn't seem to be borne out by the output I get here. What's happening?
\documentclass[a4paper]{amsart}
\usepackage{array, tikz}
\usetikzlibrary{arrows}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\tikzset{
s/.style = { font = \ttfamily,
anchor = west
},
r/.style = { draw,
shape = rectangle,
minimum width = 6mm,
minimum height = 6mm,
font = \ttfamily
},
c/.style = { draw,
shape = circle,
minimum width = 6mm,
minimum height = 6mm,
font = \ttfamily
},
arrow/.style = { ->,
> = angle 60,
thick
}
}
\newcommand{\extraSpaceAbove}{\node at (0, -0.4) {\phantom{x}};}
% Hack alert!
\begin{center}
\setlength{\tabcolsep}{4mm}
\renewcommand{\arraystretch}{1.4}
\begin{tabular}{m{30mm}|l}
\multicolumn{1}{c|}{Statement}
& \multicolumn{1}{c}{Symbol table}
\\ \hline
\tt{local a := 2;}
& \begin{tikzpicture} [x = 17.5mm, y = -7.5mm]
\extraSpaceAbove
\node [r] (a) at (0, 0) {a};
\node [c] (aval) at (1, 0) {2};
\draw [arrow] (a.east) -- (aval);
\end{tikzpicture}
\\ \hline
\tt{local b := 3;}
& \begin{tikzpicture} [x = 17.5mm, y = -7.5mm]
\extraSpaceAbove
\node [r] (a) at (0, 0) {a};
\node [r] (b) at (0, 1) {b};
\node [c] (aval) at (1, 0) {2};
\node [c] (bval) at (1, 1) {3};
\draw [arrow] (a.east) -- (aval);
\draw [arrow] (b.east) -- (bval);
\end{tikzpicture}
\end{tabular}
\end{center}
\end{document}
