I have the following problem: With the code
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\everymath{\displaystyle}
\begin{document}
\tikzstyle{block} = [rectangle, draw, fill=blue!20,
text centered, rounded corners, minimum height=4em]
\tikzstyle{line} = [-stealth, thick, draw]
\begin{tikzpicture}[node distance=5cm, text width=8em, auto]
\node [block] (A) {Block 1};
\node [block, right of=A] (B) {Block 2};
\path [line] (A) edge node [midway] {Text} (B);
\end{tikzpicture}
\end{document}
I get the following image
The text description is not shown at the center of the arrow. It seems that the start point of the error is wrong. What do I need to do to have the arrow description at the right position (middle of arrow)?
My attempts: I can change midway to at end but this does not seem to be the right solution...


text width=8em– CroCo Nov 15 '15 at 14:28minimum width=6em– CroCo Nov 15 '15 at 14:35text width? – Stephan Kulla Nov 15 '15 at 14:43yshift=1cmdoes not guarantee the node being in the middle. Better to stick with the positioning package. In this case, it is set by default to be in the middle however due to the fact that text width is taking to much space, the text is shifted to the left. – CroCo Nov 15 '15 at 15:33