1

I'd like to sort a list of words according to their lexicographical order using expl3 code. My words are in a seq variable that I access in a stack-like manner (this is not relevant, though). I've learnt of the l3sort package, but it seems as though its functions worked only for numerical variables, because I've had no trouble with my code to sort a list of integers but I've ran into trouble with non-numerical data (meaning "plain" characters; no fancy macros, expandable stuff, or the likes).

Is there a ready-made way to do this in expl3/LaTeX3? On the negative, could somebody possibly provide some hints as to how to do this?

Marcos
  • 5,422
  • I am not being allowed to comment, that is why replying with answer. Check the answer of almost similar question How to sort an alphanumeric list – Sage Sep 29 '13 at 00:45
  • Could you explain the 'trouble' you've had with non-integer values? The sort code is meant to be generic, so it would be useful to know what is wrong. – Joseph Wright Sep 29 '13 at 08:25
  • 1
    Have you seen Modifying existing code to sort a list of abbreviations or Sort subsections alphabetically? Both have answers using l3sort to sort non-numerical stuff with the help of \pdftex_strcmp:D. – cgnieder Sep 29 '13 at 09:56
  • @{cgnieder,JosephWright}: It works alright with the \pdftex_strcmp:D function. But on the expl3 doc, you can read that "D [...] means: Do not use. This special case is used for TEX primitives. Programmers outside the kernel team should not use these functions!" On the interface3 doc there is but the shortest comment made on this function. Is it fine using it? What are the plans for the l3sort module in the short-term? Is it going to be bundled with the other "regular" expl3 modules and thus not need to be loaded as an extra package? – Marcos Sep 29 '13 at 11:27
  • @JosephWright: I get the message ! Missing number, treated as zero by using the function \int_compare:nNnTF. It makes sense to me, since what the function is reading is actually an alphabetic character token, but I didn't found an alternative in the form of, let's say, str_compare:nNTF – Marcos Sep 29 '13 at 11:35

0 Answers0