Apologies if this has already been asked - I could not find it.

The following is an example of what goes wrong: enter image description here

In this example I would like it to look just like a regular 2x3 table, but I think the problem is that draw starts from the end of the math, not the end of the cell. (I'd prefer to not just use tabular as I will be arrows between columns ultimately)

\matrix[matrix of math nodes,nodes in empty cells,nodes={anchor=center},text depth=0.5ex,text height=2ex,inner sep=2pt,row sep=1.5em,column sep=1.5em,] (M)
0 & 0 & 0 \\
a+b+c+d+e & a+b+c+d+e & a+b+c+d+e \\
}    ;
\draw[] (M-1-1.north west) -- (M-1-3.north east);
\draw[] (M-2-1.north west) -- (M-2-3.north east);
\draw[] (M-2-1.south west) -- (M-2-3.south east);
\draw[] (M-1-1.north east) -- (M-2-1.south east);
\draw[] (M-1-2.north east) -- (M-2-2.south east);
\draw[] (M-1-3.north east) -- (M-2-3.south east);


1 Answer 1


If you add the option nodes={draw} option to the matrix you can see the problem clearer.

enter image description here

The quickest way to fix it is the make the nodes equal size with text width option. Regardless of their content.

So using the option nodes={text width=3cm,align=center,anchor=center} will give you

enter image description here

Now you don't need the col sep and row sep or if you do then you can get the midway between two adjacent nodes to draw the rules I would recommend a \foreach loop for such cases.


You must log in to answer this question.

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