I try to create and order text boxes with tikz-nodes. The nodes are ordered so far using the tikz positioning library. Additionally, I try to have numbers on the background of the nodes by using path picture.
Here is a minimal example:
\documentclass[tikz]{standalone}
\usetikzlibrary{positioning}
\usepackage[outline]{contour}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{environ}
\newlength{\myblockwidth}
\newcounter{boxcounter}
\newlength{\mylinewidths}
\newlength{\myinnersep}
\setlength{\mylinewidths}{5pt}
\setlength{\myinnersep}{2ex}
\NewEnviron{mycolorblock}[2][]{%
\addtocounter{boxcounter}{1}%
\setlength{\myblockwidth}{#2}%
\addtolength{\myblockwidth}{-4ex}%
\contourlength{.333pt}%
\node[
#1,
draw=orange,
fill=orange!10,
line width=\mylinewidths,
inner sep=2ex,
rounded corners = 2.5ex,
path picture={%
\node[white,
circle, draw=blue!20, line width=\mylinewidths, inner sep=.1pt,
scale = 15,
font=\bf] at (path picture bounding box.center)
{\contour{blue!20}{\the\value{boxcounter}}};}
](box\the\value{boxcounter}){
\begin{minipage}[t][]{\myblockwidth}%
\BODY
\end{minipage}%
};
}
\begin{document}
\begin{tikzpicture}[inner sep=0pt,node distance=5pt]
\begin{mycolorblock}{\textwidth}
\blindtext[2]
\end{mycolorblock}
\begin{mycolorblock}[below = of box1]{\textwidth}
\blindtext[2]
\end{mycolorblock}
\end{tikzpicture}
\end{document}
Process with pdflatex the background number for the second block (and any additional is off-center:

The background is thereby always shifted away from the center of the first block and the distance from the center of its block seems to be scaled by scale.
I am not even sure it's the positioning library which causes this behavior. If someone could point out how to fix or migrate this issue, I would by grateful.



path pictureis probably inheritingbelow = of box1. Does puttinganchor=centerin the path picture node help? – Mark Wibrow May 30 '14 at 10:29