The tikz library through can be used to draw a circle from a center coordinate A through another coordinate B like so:
\node [draw] at (A) [circle through=(B)] {};
When attempting to specify the coordinate to go through directly, i.e. without a named through coordinate
\node [draw] at (A) [circle through=(2,2)] {};
and compiling my document with pdflatex not only does that not work it also doesn't return and so gives no error message.
What does circle through do with its argument and is there a way to prevent endless compiling and come to some error message without rewriting a tikz library?
The way that works is to specify the coordinate in curly brackets
\node [draw] at (A) [circle through={(2,2)}] {};
I'm guessing through wasn't able to correctly retrieve its argument the other way.
Note that the pgfmanual 2.10 doesn't speak to that issue. The call is described as /tikz/circle through=<coordinate> (p. 474) and whenever it is used in examples named nodes are used.
I'm using TeXstudio 2.3 which runs
pdflatex -synctex=1 -interaction=nonstopmode "test-tikzcirclethrough".tex
Here is a test document:
\documentclass[10pt,a4paper]{article} \usepackage{tikz} \usetikzlibrary{through} \begin{document} \begin{tikzpicture} \coordinate (A) at (1,2); \coordinate (B) at (2,2); % Works \node [draw] at (A) [circle through={(B)}] {}; \node [draw] at (A) [circle through=(B)] {}; \node [draw] at (A) [circle through={(2,2)}] {}; % Doesn't work \node [draw] at (A) [circle through=(2,2)] {}; \end{tikzpicture} \end{document}
circle through=(2,2)is split intocircle through=(2and2)before TikZ starts figuring out what the key means. Thus the argument tocircle throughis just(2and that doesn't make a lot of sense. Putting the coordinate in braces protects the comma from the key splitter, preserving it so that it is still there when TikZ starts looking for a coordinate.throughorcircle through. You neither can re-write the library. This is the core of the underlying PGFkeys system (and it is the same way with every other key=value system).circle through={(2,2)}is the only correct way to use that option with that value. In various other situations you also need to enclose=,:,)or].\pgfkeys, p. 484 of pgfmanual (v2.10)(name)or(value1, value2)or(value1:value2)(polar coordinates) or a lot of other variants. But if the particular instance of the coordinate you use contains a comma, and it is used as a value for a key, then the whole coordinate has to be "protected" by curly braces, because of the way in which keys are parsed. The parser which interprets keys and assigns values is implemented inpgfkeys, hence the remark by PaulGaborit.