TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to insert a multirow in a tikz matrix with a grid, so:


\matrix (table) [%
  matrix of nodes,
  nodes in empty cells,
  inner sep=0mm,
  minimum size=7mm
  ] {%
  \node[draw] {A}; & \node[draw] {B}; & \node[draw] {C}; & \node[draw] {D}; \\
  \node[draw] {E}; &   &   & \node[draw] {G}; \\   };

With ugly results. Is there a way to fix this? A better way to implement it? Thanks.

share|improve this question

You have better control over the borders of your cells if you explicitly set the text height and depth. Furthermore, I would use styles to keep the code more maintainable. Here's an example of how your table could be implemented, based on the code used in " coloring every other row of a table, with vertical lines ".


    table nodes/.style={
        minimum height=7mm,
        text depth=0.5ex,
        text height=2ex,
        inner xsep=0pt,
        outer sep=0pt
        matrix of nodes,
        row sep=-\pgflinewidth,
        column sep=-\pgflinewidth,
            table nodes
        execute at empty cell={\node[draw=none]{};}

\matrix (first) [table,text width=7mm,name=table]
A   & B & C & D\\
E   &   &   & F\\
\node[draw,fit=(table-2-2)(table-2-3),table nodes]{F};


table with tikz

share|improve this answer
Can TikZ tables work like longtable which can span across pages? – xport Jul 10 '11 at 5:04
@xport: I don't think tikzpicture environments can span across pages, so TikZ matrices can't either. They're really not meant as a replacement for real LaTeX tables anyway, so you shouldn't expect too much from this approach. It can be useful if you're trying to do something special, most likely if you also need to place other TikZ elements. – Jake Jul 10 '11 at 5:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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