Hello everyone,

New context user here, coming over from the latex world.

I am writing a textbook, and wish to write the content in one file and
create multiple versions from it (theory in one document, exercise in
another, exams in yet other documents, etc).  Obviously, references between
the versions should be correct.  To write my document, I am using blocks
and enumerations.

I am facing a problem when trying to create a reference to an enumeration
created in a block that isn't used in the current version of my document.
Here is a minimal working example :

*********************
\defineblock[theory]
\defineblock[exercise]
\defineenumeration[theorem]
\defineenumeration[exercise]

\startmode[exercise]
        \keepblocks[exercise]
        \hideblocks[theory]
\stopmode

\startmode[theory]
        \keepblocks[theory]
        \hideblocks[exercise]
\stopmode

\startmode[all]
        \keepblocks[theory,exercise]
\stopmode

\starttext

\begintheory[+]
        \starttheorem[reference=thm:lambda]
                First theorem
        \stoptheorem
\endtheory

\beginexercise[+]
\startexercise[reference=ex:omega]
        First exercise.

        We use \in{theorem}[thm:lambda]
\stopexercise
\endexercise
\stoptext
*********************

When compiling this example with mode=all, we see that the theorem gets its
number (1) and the reference in the exercise is right.  When compiling with
mode=exercise, the reference in the exercise displays ?? instead of 1.
Obviously, this is because the reference mechanism was not created to
reference items that don't exist in the document... yet here I am ;).

Would there be a way to retrieve the label text of a reference if that
reference is in a block that is not typeset?  Similar to how enumeration
counters get incremented for enumerations that are in hidden blocks if you
specify [+] when writing the block, or if you use \processblocks.

Thanks for your answers,
Yves Debongnie
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to