[NTG-context] Help wanted: cross referencing

Otared Kavian otared at gmail.com
Wed Apr 8 10:45:26 CEST 2015

Maybe a third post will get attention from a guruâ€¦

Hi all,

As explained in the example below, I would like to setup the referencing mechanism so that a cross reference within a given chapter gives only the number of the section and that of an equation, while if the same reference is used in another chapter then the number of the chapter is also included. Is this possible with mkiv?

Best regards: OK
Here is a minimal example of what I would like to obtain:
%%%%% begin prefix-reference.tex
\setupinteraction[state=start]
\setupformulas[prefix=yes,prefixsegments=chapter:section,way=bysection,location=left]
\def\eqref#1{(\in[eq:#1])}

\starttext
\startchapter[title=Introduction to sequences of numbers]

\startsection[title=On sequences,reference=sec:Sequences]
\placeformula[eq:Number-e]
\startformula
a_{n} := \sum_{k=0}^n {1 \over n!}
\stopformula
\stopsection

The sequence defined in equation \eqref{Number-e} cannot converge to a rational number.

(Here I would like to have (1.1) instead of (1.1.1)).

\startsection[title=Cauchy sequences]

The sequence defined in \eqref{Number-e} satisfies $a_{n} < a_{n+1} < 3$ but it does not converge to a rational number.

(Here I would like to have (1.1) instead of (1.1.1)).

\stopsection
\stopchapter

\startchapter[title=What is a real number]

\startsection[title=Limits of Cauchy sequences]
We proved in \in{section}[sec:Sequences] that the sequence defined in equation \eqref{Number-e} cannot converge to a rational number.

(Here I would like to have section 1.1, and equation (1.1.1)).
\stopsection
\stopchapter
\stoptext
%%%%% begin prefix-reference.tex