# [NTG-context] cross references to chapters in a book

Robert Zydenbos context at zydenbos.net
Fri Feb 22 22:13:46 CET 2019

Still nicer would be the following, but I do not know whether this is technically possible –

I have the following text:

% start of example: in chapter 4, pp. 38, I have
\subject [wild-stuff]{Wild stuff}
Now comes a lot of weird stuff which I want to refer to later.
…
% end of stuff in one chapter

% in another chapter:
As we already saw in \in{chapter}[wild-stuff], on p.~\at[wild-stuff]
% that was in the other chapter
% end of example

and the result would be: “As we already saw in chapter 4, on p.~38”…

Can such a thing be done?

Robert

> On 22. Feb 2019, at 22:04, Robert Zydenbos <context at zydenbos.net> wrote:
>
> Hmm… although I got your example to work after some tweaking (changing \samplefile to {input and placing knuth.tex and zapf.tex in the same folder as the test file), I could not reproduce this with my book. I want to get "chapter 4" but keep getting "chapter 4.0".
>
> Is this because I am using MkII with XeTeX?
>
> Robert
>
>> On 22. Feb 2019, at 20:47, Wolfgang Schuster <wolfgang.schuster.lists at gmail.com> wrote:
>>
>> Robert Zydenbos schrieb am 22.02.19 um 17:14:
>>> Dear wizards of ConTeXt,
>>> In the final stage of completing a book project, I was wondering how to automatize cross references to chapters. I’ve already figured out how to refer to pages (using “\at[REFERENCE]”), but how is this done with chapters? I’m apparently too simple-minded to understand the manual (and I don’t understand the differences between \reference, \textreference, \in, \about).
>>
>> When you use \chapter:
>>
>> \starttext
>>
>> \chapter[sec:knuth]{Knuth}
>>
>> \samplefile{knuth}
>>
>> See \in{chapter}[sec:zapf] at \at{page}[sec:zapf].
>>
>> \chapter[sec:zapf]{Zapf}
>>
>> \samplefile{zapf}
>>
>> See \in{chapter}[sec:knuth] at \at{page}[sec:knuth].
>>
>> \stoptext
>
>