I could not find many examples for the correct use of arguments patterns in pgfkes, but I was able to come up with the following:
\documentclass{standalone}
\usepackage{tikz}
\tikzset{dimen/.style={<->,>=latex,thin,
every rectangle node/.style={fill=white,midway}
}}
\tikzset{measuring south/.style args={from #1 to #2 is #3}{
append after command={
draw (#1.south west) -- ++(0,-1.0)
coordinate (A1) -- ++(0,-10pt)
(#2.south east) -- ++(0,-1.0) coordinate (A2) -- ++(0,-10pt)
[dimen] (A1) -- (A2) node {#3}
}
}
}
\begin{document}
\begin{tikzpicture}
\node(a) [draw,rectangle,text=teal] at (0,0) {here};
\node(b) [draw,rectangle,text=olive] at (3,0) {there};
\path[measuring south=from here to there is far,fill=red];
\node(x) [draw,rectangle,text=blue] at (0,-2) {Heaven};
\node(y) [draw,rectangle,text=red] at (3,-2) {Hell};
\draw (x.south west) -- ++(0,-1.0)
coordinate (A1) -- ++(0,-10pt)
(y.south east) -- ++(0,-1.0) coordinate (A2) -- ++(0,-10pt)
[dimen] (A1) -- (A2) node {sin};
\end{tikzpicture}
\end{document}
In my output, I would have liked to see the dimension lines from "here" to "there", but these are not visible.
Best Answer
From the TikZ/PGF manual (emphasis added):
The key here is the "some". The
append after command
needs a command to be appended after. Things that work arenode
,edge
,to
, and likewise. Your\path
has no commands and so there is no chance of theappend after command
being executed. What you want here is theinsert path
key which sticks in the path at that point. Once you change that, then you get some output but you also find a few other (small) errors: you didn't name the nodeshere
andthere
, thefill=red
command is a little odd, and thedraw
needs to be in brackets to be interpreted as a style.