Hi Hans,

I try to set and access a reference in the example below but both
\in and \at result in a fatal error. What’s missing in my code,
I looked in the float and math code but I can’t find a solution.

\starttexcode

\installnamespace                {test}
\installcommandhandler \????test {test} \????test

\installstructurelistprocessor{test}{\usestructurelistprocessor{number+title}}

\unexpanded\def\test_cmd[#1]#2#3%
  {\begingroup
   \edef\currenttest{#1}%
   \dostructurecountercomponent
     {test}%
     \setupcurrenttest
     \testparameter
     \detokenizedtestparameter
     \relax
     \relax
     \relax
     [\c!name=\currenttest,%
      \s!counter=\currenttest,%
      \s!hascaption=\v!yes,%
      \s!hasnumber=\v!yes,%
      \s!hastitle=\v!yes,%
      \c!reference=#2,%
      \c!title={#3},
      \c!bookmark=]%
     []%
   \laststructurecountersynchronize
   \attribute\destinationattribute\laststructurecounterattribute\emptyhbox
   \endgroup}

\appendtoks
  \setuevalue\currenttest{\test_cmd[\currenttest]}%
\to \everydefinetest

\appendtoks
  \definenumber[\currenttest]%
  \definelist  [\currenttest]%
\to \everydefinetest

\stoptexcode

\definetest[test]

\setupnumber[test][prefix=yes]

\starttext

\placelist[test]

\blank

\test{test:1}{This is the title!}

Test 1: \getnumber[test]

\test{test:2}{This is the next title!}

Test 2: \getnumber[test]

\blank

\in{test}[test:2] \at{page}[test:2]

\stoptext

Wolfgang