5.11 @anchor: Defining Arbitrary Cross-reference Targets

An anchor is a position in your document, labelled so that cross-references can refer to it, just as they can to nodes. You create an anchor with the @anchor command, and give the label as a normal brace-delimited argument. For example:

This marks the @anchor{x-spot}spot.
...
@xref{x-spot,,the spot}.

produces:

This marks the spot.
...
See [the spot], page 1.

As you can see, the @anchor command itself produces no output. This example defines an anchor ‘x-spot’ just before the word ‘spot’. You can refer to it later with an @xref or other cross reference command, as shown (see Cross-references).

It is best to put @anchor commands just before the position you wish to refer to; that way, the reader’s eye is led on to the correct text when they jump to the anchor. You can put the @anchor command on a line by itself if that helps readability of the source. Whitespace (including newlines) is ignored after @anchor.

Anchor names, node names and float labels may not conflict. Anchors, nodes and float labels are given similar treatment in some ways; for example, the goto-node command takes either an anchor name or a node name as an argument. (See Go to node in Info.). Anchors names and float labels could also appear in menus (see Menus) and node direction pointers (see Writing a @node Line), although this is not recommended.

Anchor names share the same constraints as nodes on the characters that can be included (see Info Node Names Constraints).

Because of this duality, when you delete or rename a node, it is usually a good idea to define an @anchor with the old name. That way, any links to the old node, whether from other Texinfo manuals or general web pages, keep working.