troff2page provides a .TAG macro for managing cross-references. A compatible groff definition is provided in the supplied macro file pca-tag.tmac. (This overrides the similarly named macro in groff’s www.tmac, in order to allow forward references.)
associates the label TAG_sec:troffcl with the number of the current page. The string \*[TAG_sec:troffcl] is defined to typeset as that page number. Thus, in a hand-crafted table of contents, you could use
Extending troff using Common Lisp, \*[TAG_sec:troffcl]
In the HTML output, the string \*[TAG_sec:troffcl] furthermore is a link to where .TAG sec:troffcl was called.
.TAG takes an optional second argument. The label is then associated with the text of the second argument instead of the current page number.
troff2page comes with the macro files pca-toc.tmac and pca-sec.tmac that use .TAG to help generate a table of contents (ToC).
troff2page also comes with the macro file pca-t2p-man that automatically generates a ToC for man pages, with a ToC entry for each .SH in the input.