# Is there a way to sort a numbered list automatically? [duplicate]

Possible Duplicate:
How to sort an alphanumeric list

For example, I have the following code:

\begin{enumerate}
\item Rabbit
\item Apple
\item Serpent
\end{enumerate}


Is there a way to add something to this and get a sorted, numbered list as output?

-
 Related question: tex.stackexchange.com/questions/6988/… There the issue is solved in multiple different ways. – Vairis Apr 23 '12 at 9:28

## marked as duplicate by tohecz, Thorsten, cmhughes, Alan Munn, lockstepApr 23 '12 at 15:55

You can use a comma delimited list and then sort it. Here is a MWE.

\documentclass{article}
\usepackage{lstdoc,booktabs}
\makeatletter
\let\alist\@empty

\lst@BubbleSort{\alist}
}

\parindent0pt
\newcounter{cnt}
\setcounter{cnt}{0}
\begin{document}


You can format the output within the \@for loop.