# [NTG-context] sorting commalist?

Taco Hoekwater taco at elvenkind.com
Fri Jul 28 23:13:18 CEST 2006

Hans van der Meer wrote:
>
> Is there a simple manner to sort the list externally and get it back
> for further processing? Otherwise, how are the indexes sorted?

Externally, using texexec functionality. Something like this
works well enough, I guess (but I normally sort my stuff by
piping it through the unix sort command):

% This sorts the list contained in it's argument
\def\sortalphacommacommand#1%
{\definesorting[listsort][listsorts]%
\processcommacommand[#1]\listsort
\def\sortedcommalist{}%
\def\makesortedlist##1%
{\doglobal\appendtocommalist{##1}\sortedcommalist}%
\setupsorting[listsort][criterium=all,command=\makesortedlist]%
\placelistoflistsorts
\let#1\sortedcommalist}

\def\citylist{Londen,Berlijn,New York,Parijs,Amstelveen}

\sortalphacommacommand\citylist

Cheers, taco