I want keep track of which other sections any given section refers to by creating lists like \fromrefA => refX,refY,refZ \fromrefB => refY,refZ ... My plan is to achieve this by writing commands like \ignore{1.2} \appendtovaluelist{fromrefA}{refX} \ignore{1.4} \appendtovaluelist{fromrefA}{refY} \ignore{1.3} \appendtovaluelist{fromrefA}{refZ} \ignore{1.4} \appendtovaluelist{fromrefB}{refY} \ignore{1.3} \appendtovaluelist{fromrefB}{refZ} ... to a file that is subsequently processed on the following run. Here references refX, refY and refX refer to sections 1.2, 1.4 and 1.3, respectively. The section numbers will be ignored by ConTeXt but by including this information the lists can be ordered by section number by simply sorting the file between the calls to texexec. However, this simple way to get sorted lists turns out to be too tricky for me. I am simply unable to write the section numbers to the file. To be more specific I am not able to expand \in[refX] in such a way that the resulting section number is written to the file. Any help would be greatly appreciated. Thanks in advance, Fredrik