The exsheets package allowed for referencing a previous exercise through its ID tag with \exerciseNumber{<id>}. Changing to XSIM now, I could not find an equivalent. The \GetExerciseProperty{ID} provides the ID of the current exercise (manual v0.11, p. 31), but I could not find a way to access the number of a previous question in XSIM using its ID (or id; manual p. 10).

I could provide a separate \label{} in one question and refer to it with \ref{} later. But I would prefer to directly access the ID tag.

Background: I have a collection of ~300 exercises built with exsheets and heavy cross-referencing. Now I want to convert it to xsim without having to manually add labels and refs.


There is no such command at the moment but it is possible to define one:


\NewDocumentCommand \exercisenumber {m}
      { \xsim_get_id_for_property:nn {ID} {#1} }
\cs_generate_variant:Nn \xsim_get_property:nnn {nx}  




  See exercise \exercisenumber{foo}. \lipsum[1]


enter image description here

  • Thanks, Clemens, does exactly what I needed! Great! Oct 2 '19 at 17:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.