\showreferences

From ConTeXt wiki

When writing a long document with many cross references, at the stage of proof reading, it comes handy if one could visualize what are the names given to various nodes (in ConTeXt parlance « nodes.destinations ») and also to visualize what destinations are invoked in the text (in ConTeXt they are named « nodes.references »).

There is a command named

\showreferences

which just does this: it prints in small fonts, to the left of each such node the name of the destination, or the name of the reference used at that point. Let us show it in action in the following (not so minimal) example (to be typeset with mkiv):

\setupinteraction[state=start]
\setupbodyfont[10pt,palatino]
\useMPlibrary[dum]

%\usemodule[references-show]

%\enabletrackers[nodes.references,nodes.destinations]

\showreferences

%\enabletrackers[nodes.references.show]

%\enabletrackers[nodes.references]

%\enabletrackers[nodes.destinations.show]

%\enabletrackers[nodes.destinations]

%\enabletrackers[nodes.references.show=2.5]
%\enabletrackers[nodes.destinations.show=1]

\definereferenceformat[eqref][left=(,right=)] 
\setupformulas[location=right]

\starttext

\startchapter[title=Some references,reference=ch:New]

\startsection[title=Some facts,reference=sec:First]
We have
\placeformula[eq:Square]
\startformula
a^2 + 2ab + b^2 = (a + b)^2,
\stopformula
for $a,b\in {\Bbb C}$. Also,
\placeformula
\startformula
\startalign
\NC \alpha^2 -2\alpha\beta + \beta^2 \NC = (\alpha - \beta)^2. \NR[eq:Identity]
\NC ||x||^2 + ||y||^2 \NC= (x+y|x+y) \NR[eq:Pythagore]
\stopalign
\stopformula  
Note that \eqref[eq:Square] is true whenever we have $ab = ba$ for $b,a \in {\Bbb A}$. This is not the case when ${\Bbb A}$ is the ring of the matrices.
It is clear that \eqref[eq:Identity] is a consequence of \eqref[eq:Square].


\startitemize[n]

\item[it:1]
Testing items to see where are the reference points and names.

\startitem[it:2]
Testing items for show reference
\stopitem

\stopitemize

See \in{item}[it:2] in \in{section}[sec:First].

\startplacefigure[reference=fig:1]
\externalfigure[dummy]
\stopplacefigure

See \in{figure}[fig:1], and then have a look at \in{section}[sec:Testing] of \in{chapter}[ch:New].

\stopsection

\startsection[title=Testing \type{\showreferences},reference=sec:Testing]

\input knuth.tex

\stopchapter

\stoptext

When typeset, with mkiv, this gives all the informations used for cross referencing.

There is also a module, which is invoked by saying:

\usemodule[references-show]

which does somewhat more: not only the command \showreferences is activated, but on the top right corner of each page, a short list of all the references on that page is printed.

Actually, due to the fact that some of the informations is written between lines, depending on the bodyfont used in the document, one may need to fine tune more or less the position of the small prints: you can play with the following commands

\enabletrackers[nodes.references.show=2.5]
\enabletrackers[nodes.destinations.show=1]

by changing the numerical values according to your needs (remember nodes.destinations means the point where you have given a name to a certain object, and nodes.references corresponds to the point at which you refer to those objects).

Another useful information is that the command

\showreferences

is an alias for the following command

\enabletrackers[nodes.references.show,nodes.destinations.show]

and you may enable only the tracking of either of the nodes, for instance by saying

\enabletrackers[nodes.destinations.show]

you can visualize only the destinations nodes, or you may say

\enabletrackers[nodes.references.show]

to see only where the references are invoked.

Finally, there is a command

\enabletrackers[nodes.references,nodes.destinations]

which allows to visualize the objects which are destination or reference nodes (again, the above command can be split in two).