[NTG-context] Cross-referencing Challenge

Aaron W. Hsu arcfide at sacrideo.us
Sun Apr 15 00:44:16 CEST 2012


Hey All:

I am very new to ConTeXt, but I am trying to use it to achieve a format
similar to what you can get from WEB systems. Right now I am working on
the definitions of chunks and their cross references.  I have three main
macros:

\defchunk   Definining a new chunk \chunk      Referencing a chunk by name
\stopchunk  Ending a chunk definition

Here is an example:

\defchunk{This is a name}
Some text /BTEX\chunk{Other stuff}/ETEX goes here.
And here.
\stopchunk

\defchunk{Other stuff}
Something else \stopchunk

\defchunk{This is a name}
Some other stuff.
\stopchunk

Now, at the end, let's say that each of these appears in sections 1, 2,
and 3, respectively.  The output I am looking for, in Unicode, might look
like this:

⟨This is a name 1⟩≡
  Some text ⟨Other stuff 2⟩ goes here.
  And here.
──
See also section 3.

⟨Other stuff 2⟩≡
  Something else
──
This code is used in section 1.

⟨This is a name 1⟩≡
  Some other stuff.
──

So here, there are really three things that I want to achieve.  I need to
be able to get a list of all of the sections wherein a given chunk is
referenced using \chunk, a list of all the sections where a section of the
same name is defined, and finally, be able to tell in which section the
first occurrence of a chunk is defined.

How can I accomplish this?


-- 
Aaron W. Hsu | arcfide at sacrideo.us | http://www.sacrideo.us
Programming is just another word for the lost art of thinking.



More information about the ntg-context mailing list