TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

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

Another question about aligning nodes using matrices in tikz. Consider the following:



\matrix (m)[matrix of nodes, column  sep=5mm,row  sep=3mm, align=center,
nodes={rectangle,draw, text width = 2cm} ]{
                & \node{row1-2};    &                        \\
\node{row2-1};      &               & \node{row2-3 long in two rows};\\

\draw[->] (m-1-2) |- (m-2-1);
\draw[->] (m-1-2) |- (m-2-3);


which yields me this:

Unaligned nodes

How can the boxes in the second row be aligned properly?

share|improve this question

migrated from stackoverflow.com Oct 3 '12 at 9:23

This question came from our site for professional and enthusiast programmers.

up vote 11 down vote accepted

Figured it out. Just add anchor=center to the node definition, and this does the trick:

enter image description here

share|improve this answer

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.