Improve command to generate table on contents

Add a call to 'sort' to avoid duplicates caused by the printing of the
existing table.