I want to place a node, that is kind of a note, behind another node.
However, I need to put the reference node before the note, so I can place the note in a relative position to the reference node. So, the reference node is draw behind the note. But I want the reverse.
For example, in this figure the note is over the node. However, I want it below of the decision node.
- So, how can I place the note behind the reference. Or is there a way to put notes to the nodes natively in TikZ?
- The other thing is, why the text in the note is not centered?
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,shadows,positioning}
\begin{document}
\tikzstyle{decision} = [diamond, draw, fill=blue!5, text width=6em, text badly centered, node distance=2.5cm, inner sep=0pt]
\tikzstyle{block} = [rectangle, draw, fill=blue!5,
text width=7em, text centered, rounded corners, minimum height=4em]
\tikzstyle{note} = [rectangle, dashed, draw, fill=white, font=\footnotesize,
text width=5em, text centered, rounded corners, minimum height=4em]
\tikzstyle{line} = [draw, very thick, color=black!50, -latex']
\begin{tikzpicture}[scale=2, node distance = 2cm, auto]
\node [block] (blk) {A block here};
\node [decision, below of=blk] (if) {Is something?};
\node [note,below right=-5mm of if, anchor=north west] (note1) {using a note here};
\path [line] (blk) -- (if);
\end{tikzpicture}
\end{document}
Best Answer
A variant of Azoun's solution is to use the
backgrounds
tikz library. The code is