% This file is embedded in datatool-user.pdf version 3.1 2025-03-10 % Example 57 Sorting Lists with \dtlsortlist (comma and parenthetical markers) % Label: "ex:sortlistcommas" % arara: pdflatex % arara: pdfcrop \documentclass[10pt]{article} \pagestyle{empty} \usepackage{multicol} \usepackage{datatool-base} \newcommand{\mylist}{duckling, Duck\datatoolplacecomma Mallard County, Duck\datatoolpersoncomma Robbie, Duck\datatoolsubjectcomma Anatomy of a, duck\datatoolparenstart (cricket), duck\datatoolparen{verb}, {Duck, Duck, Goose}, duck soup, duck, duck and dive } \renewcommand{\DTLlistformatsep}{\newline} \renewcommand{\DTLlistformatlastsep}{\newline} \DTLsetup{compare={expand-cs=true}} \begin{document} \begin{multicols}{3} {\dtlsortlist{\mylist}{\dtlicompare} Case-insensitive:\newline \DTLformatlist{\mylist}.} {\dtlsortlist{\mylist}{\dtlwordindexcompare} Word sort:\newline \DTLformatlist{\mylist}.} \dtlsortlist{\mylist}{\dtlletterindexcompare} Letter sort:\newline \DTLformatlist{\mylist}. \end{multicols} \end{document}