Numbering items of a list, with a prefix containig the number of the section in which the list is

hello

i have this
section 1

  1. ccc
  2. ddd
    section 2
  3. eee
  4. fff
  5. ggg

i would like to get this :
section 1
1-1) ccc
1-2) ddd
section 2
2-1) eee
2-2) fff
2-3) ggg

that’s because my list are long (several pages each list of exercises) and it may be difficult when reading a, say, exercise 14, to guess if it is the ex. 14 of section 1, or ex 14 of section 2 or…

i can use a \label and \ref okay but i have no idea how to put them in prefix of the number of the item

Vinz

Pls. try the following definition in the preamble

<assign|the-item|<macro|<section-prefix><transform-item|<value|<counter-item>>>>>

I looked at how the “prefixing by section numbers” of exercises is done and I did it in a similar way (I think).

  • Might be also good to write exercises with a suitable modification of the exercise macro? It depends on what you want to achieve.
  • If you nest enumeration lists, it could also be useful to use the “Prefix nested numbers” option (from the ribbon menu of Enumerate); in fact the macro I pasted above prepends the section number to the item number at all enumeration levels, and in a nested list the section number looks like the item number of the item that encloses the nested list. In this case I need to either change the macro or to adjust something else, as (without entering into detail) the one I wrote does not work well with that option.

Pls. let me know.

2 Likes