# \anchor vs. \deferredanchor (of a PGF node)

What is the difference between a PGF node's anchor and a PGF node's deferred anchor? the TikZ & PGF manual for version 3.0.1a describes the command `\deferredanchor{〈name〉}{〈code〉}` thus (p. 1037):

This command declares an anchor named `〈name〉`. It works like `\anchor`. However, unlike for anchors declared by `\anchor`, `〈name〉` will not be expanded during the shape declaration (i.e. not during `\pgfdeclareshape`). Rather, the `〈name〉` is expanded when the node is actually used (with `\pgfnode` or more likely with `\node`). This may be useful if the anchor name is context dependent (depending, for example, on the value of a key).

I'll repeat:

unlike for anchors declared by `\anchor`, `〈name〉` will not be expanded during the shape declaration

However the description of the `\anchor{〈name〉}{〈code〉}` command reads (p. 1036):

Unlike for saved anchors, the `〈code〉` will not be executed each time a node is declared. Rather, the `〈code〉` is only executed when the anchor is specifically requested; either for anchoring the node during its creation or as a position in the shape referenced later on.

So what's the difference? Neither command is executed when the node is declared, but rather when it is explicitly requested upon creation or use.

• For packages such as `tqft`, there are nodes with various number of anchors (see page 11 of its manual). This is where `\deferredanchor` kicks in. – Symbol 1 Jul 23 '17 at 13:07
• @Symbol1: Sorry, I don't get it. Also, why does the description for the `\deferredanchor` command I quoted above says: 'unlike for anchors declared by \anchor, 〈name〉 will not be expanded during the shape declaration'? Are anchors expanded during shape declaration? And why does the description for the `\anchor` command I quoted above says: 'the 〈code〉 will not be executed each time a node is declared.' How many times is a node declared? Only once, no? – Evan Aad Jul 23 '17 at 13:15
• You see: the difference is that anchors has fixed name while deferredanchors has its name finalized when a node is created. However, I have to say that I cannot find any usage in my local tex library. (`tqft` uses different approach) You might want to forget this macro. – Symbol 1 Jul 23 '17 at 13:26

Say, you have a shape that has n-many extensions (can't think of a better example now other than `regular polygon` with varying sides) with different shapes, say, a triangle a circular and something else.
`\anchor` is well-defined but not prepared. `\deferredanchor` is not even defined until expanded. Because its name still can depend on what is requested.