Mikael P. Sundqvist <mailto:mic...@gmail.com>
4. November 2016 um 16:33
Thank you very much Wolfgang!
Now I can get exactly what I need, see the example below (also tested
with my larger document, available at
http://www.maths.lth.se/matematiklth/personal/mickep/analysB2ht16/analys-context.pdf).
I'm very happy about this solution. Also, thanks to Hans for giving us
this very nice tool (I usually only write to the list when I have
problems, sorry)!
With the new beta you can set a default prefix for enumeration references,
i.e. you can write \startquestion[knuth] in your document without the need
to add a question or answer prefix.
\setupinteraction[state=start]
\define[1]\QuestionTextCommand
{\doifreferencefoundelse{answer:\currentconstructionreference}
{\goto{#1}[answer:\currentconstructionreference]}
{#1}}
\define[1]\AnswerTextCommand
{\doifreferencefoundelse{question:\currentconstructionreference}
{\goto{#1}[question:\currentconstructionreference]}
{#1}}
\defineenumeration
[question]
[text=Question,
headcommand=\QuestionTextCommand,
referenceprefix=question]
\defineenumeration
[answer]
[text=Answer,
headcommand=\AnswerTextCommand,
referenceprefix=answer]
\starttext
\startquestion[knuth]
\input knuth
\stopquestion
\page
\startanswer[knuth]
\input knuth
\stopanswer
\stoptext
Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________