Hi Sonia,
Unfortunately,
Smarty doesn't have an array ordering function (I did look for this one when I wrote the code...).
There's two options as I see it:
1: modify categories.php so that the allcategories array is sorted by position (or probably better, create a sorted allcategories array clon and working with it from the .tpl)
2: create a smarty {sortarray} function. Perhaps a more drastic approach, but then again, a good way to contribute to a different project!!