1

I'm trying to figure out how to create a table with the \matrix command.

Almost got it, but not quite:

\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{matrix}

\begin{document}
\begin{tikzpicture}
\matrix (m) [matrix of nodes,
nodes={draw=black, font={\ttfamily}, align=left, text width=1.5cm},
column sep=0,row sep=0,
column 1/.style={minimum width=2cm},
column 2/.style={minimum width=3cm},
]{
foo & 1 \\
bar & "Wilson"\\
baz & true \\
quux & 8.736e22 \\
};

\end{tikzpicture}
\end{document}

The space between cells is screwed up; how can I fix?

enter image description here

0

1 Answer 1

1

Set the text height for the nodes, currently the nodes are adjusting their height to the box within them.

See also https://tex.stackexchange.com/a/191240/113380

4
  • any way to do that on a row-by-row basis in case some rows are oddball?
    – Jason S
    Commented Oct 21, 2016 at 2:50
  • This might help: tex.stackexchange.com/questions/191239/… Commented Oct 21, 2016 at 3:28
  • Wait -- this doesn't work, I tried adding minimum height=2cmto line 8 and it does increase the height of all the cells but there's still that damned gap before quux.
    – Jason S
    Commented Oct 21, 2016 at 4:52
  • Try setting text height and text depth. See revised answer Commented Oct 21, 2016 at 6:04

You must log in to answer this question.

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