# [NTG-context] reference to \starttyping

Sat Dec 9 02:42:20 CET 2006

```On Sat, 9 Dec 2006, andrea valle wrote:

> Hi to all,
>
> I'm typesetting a manual for a programming language. I'm inserting long
> excerpts from code and I have my nice line numbers as explained by the
> wiki.
> Code is inserted using \startcode\stopcode mechanism (I have two type
> of starttyping).
> I cannot understand how to refer to these code blocks. I mean, I need
> to have something like this: "in the code at page xxx, ...".
> I guess it's simple but seems I cannot solve.

Add \pagereference[tag] before (or include it as part of the macro)
\startcode. Then you can refer to it by \at[tag]

There is also \textreference and \reference. From core-ref.tex

%D This module deals with referencing. In \CONTEXT\ referencing
%D is one of the core features, although at a first glance
%D probably nobody will notice. This is good, because
%D referencing should be as hidden as possible.
%D
%D In paper documents, referencing comes down to cross
%D referencing, but in their interactive counterparts, is also
%D involves navigation. Many features implemented here are
%D therefore closely related to navigation.
%D
%D Many \CONTEXT\ commands can optionally be fed with a
%D reference. Such a reference, when called upon, returns the
%D number of a figure, table, chapter etc, a piece of text, or
%D a pagenumber.
%D
%D There are three ways of defining a reference:
%D
%D \starttyping
%D \pagereference[here]
%D \textreference[here]{some text}
%D \stoptyping
%D
%D the third alternative combines them in:
%D
%D \starttyping
%D \reference[here]{some text}
%D \stoptyping

HTH,