[NTG-context] "Smart" \in

Giuseppe Bilotta gip.bilotta at iol.it
Sun Oct 9 12:18:54 CEST 2005


Saturday, October 8, 2005 Hans Hagen wrote:

> Giuseppe Bilotta wrote:

>>Hello all,
>>
>>I have a document which is split into separate \parts. I
>>would like the \in command (& friends) to automatically add
>>the "part" reference when cross-referencing across parts.
>>
>>Example:
>>
>>
>>"""
>>\part[part:one]{Part one}
>>
>>\chapter[ch:one]{Chapter one}
>>
>>\chapter[ch:two]{Chapter two}
>>As seen in \in chapter[ch:one]
>>
>>\part[part:two]{Part two}
>>
>>\chater[ch:2-1]{Chapter two}
>>
>>As seen in \in chapter[ch:one]
>>"""
>>
>>The first \in would say chapter~1, the second chapter~1,
>>part~1.
>>
>>  
>>
> \setuphead[part][prefix=part]
> \setuphead[chapter][prefix=ch]

> \setuphead[chapter]prefix=+] % kind of automatic

> (actually, prefixes are blabla::whatever deep down in context)


Looks like I didn't make myself clear. I don't want the
label prefix to be automatic.

I want the reference to automatically add "part ..." (in the
text) when the current part is different from the part of
the referenced thing.

I see that the example was too verbose to be minimal
enough. Second go:

"""
\starttext
\part{Part one}
\chapter[interest]{Chapter one}
\chapter{Chapter two}
As seen in \in chapter[interest]
\part{Part two}
\chapter{Chapter one of part two}
\chapter{Chapter two of part two}
As seen in \in chapter[interest]
\stoptext
"""

If you compile this example, you'll see that both \in's
print the same output, but the second one is referring to
chapter 2 in part 1, and this is not clear (it seems it's
referring to chapter 1 in the same part), so it should add
", part 1" to make it clear.

-- 
Giuseppe "Oblomov" Bilotta



More information about the ntg-context mailing list