I am new to Expl3 and would like to be able to use a counter by retrieving its name dynamically, performing this operation within a user command for other stuff. I am unable to display the counter value. I may be making a beginner's mistake, but I don't know where it might be... Here is the minimal example I am working on :
\documentclass{article} \ExplSyntaxOn % declare counter \int_new:N \g_strxdiv_leveliv_division_count_int % initialize counter \int_gset:Nn \g_strxdiv_leveliv_division_count_int { 1 } % Construct the counter name dynamically \cs_new:Npn \__strxgen_construct_counter_name:nn #1% first variable part #2% second variable part { g_strx#1_#2_count_int % used as-is, \__strxgen_construct_counter_name:nn { div } { leveliv } gives the correct name ('g_strxdiv_leveliv_count_int') } % For user purposes \NewDocumentCommand\Test { m m } { \int_use:c { \__strxgen_construct_counter_name:nn { #1 } { #2 } } % <other stuff should be placed here using the counter once "reconstructed"> } \ExplSyntaxOff \begin{document} \Test{div}{leviv} % displays the error messg 'You can't use '\relax' after the. (...)' ) % Thinking it was an expansion issue with \int_use:c, I've tried with \exp_args:... without more success. \end{document} Thank you so much for your help.
