I try to use the TikZ's Fitting Library with coordinates but it didn't compile.
In the manual of TikZ we got
This option must be given to a node path command. The coordinates or nodes should be a sequence of Tik Z coordinates or node names, one directly after the other without commas (like with the plot coordinates path operation). Examples as (1,0) (2,2) or (a) (1,0) (b), where a and b are nodes.
So I try
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{fit}
\begin{document}
\begin{tikzpicture}
\node (foo) at (0,0) {foo};
\node (bar) at (2,0) {bar};
\node[draw, fit=(0,0) (2,0)] {};
\end{tikzpicture}
\end{document}
and got the following error:
! Undefined control sequence.
\pgfmathsetlength ...\pgfmath@onquick #2\pgfmath@
{\begingroup \pgfmath@sele...
l.9 \node[draw, fit=(0,0) (2,0)]
{};
If I use node labels instead of coordinates, as below, I got no error.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{fit}
\begin{document}
\begin{tikzpicture}
\node (foo) at (0,0) {foo};
\node (bar) at (2,0) {bar};
\node[draw, fit=(foo) (bar)] {};
\end{tikzpicture}
\end{document}
I'm using
$ pdflatex --version
pdfTeX 3.1415926-2.4-1.40.13 (TeX Live 2012)
kpathsea version 6.1.0
...
with
$ tlmgr info pgf
package: pgf
...
installed: Yes
revision: 22614
cat-version: 2.10
cat-date: 2010-10-27 12:56:09 +0200
cat-license: lppl1.3
collection: collection-pictures
...



fit={(1,2) (2,3)}. – Andrew Stacey Nov 22 '12 at 23:08