% This file is embedded in datatool-user.pdf version 3.4.1 2025-04-25
% 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}
