Enumeration with reversed numbering

Enumeartion with reversed numbering is very useful for listing items such as publications in CV. Latex has the package etaremune to do this. I suppose I can create a custom macro for this but wonder if somebody has already done this.

1 Like

I think one would be able to do that if one would be able to find out which is the last item number in a list, and I have not been able to do so.
It is not last-item-nr. Does anyone have an idea?

This is indeed a good problem. A not-so-perfect solution can be this:

(document 
  (new-list "sub-rev-enumerate" 
     (value "aligned-dot-item") 
     (macro "name" 
       (concat "[" 
               (minus (get-binding "rev-list-size") (arg "name"))
                "]")))
  (assign "rev-enumerate" 
     (macro "body" 
        (document (sub-rev-enumerate (arg "body"))
              (set-binding "rev-list-size" (plus (value "last-item-nr") "1"))))) "")

but it is using a global counter to keep track of who many item one has and then use it in a second typesetting passage. This works like references, so one needs multiple passes to have the correct numbering. I guess there is no better solution. The problem with this macro is that it is using a single counter which will not work when one has multiple reverse lists in a document.
Exercise for the reader: modify it to use a different counter every time the reverse-enumeration environment is invoked.

1 Like