| 1 |
% This file is embedded in datatool-user.pdf version 3.4.3 2025-12-04 |
| 2 |
% Example 57 Sorting Lists with \dtlsortlist (comma and parenthetical markers) |
| 3 |
% Label: "ex:sortlistcommas" |
| 4 |
% arara: pdflatex |
| 5 |
% arara: pdfcrop |
| 6 |
\documentclass[10pt]{article} |
| 7 |
\pagestyle{empty} |
| 8 |
\usepackage{multicol} |
| 9 |
\usepackage{datatool-base} |
| 10 |
\newcommand{\mylist}{duckling, |
| 11 |
Duck\datatoolplacecomma Mallard County, |
| 12 |
Duck\datatoolpersoncomma Robbie, |
| 13 |
Duck\datatoolsubjectcomma Anatomy of a, |
| 14 |
duck\datatoolparenstart (cricket), |
| 15 |
duck\datatoolparen{verb}, |
| 16 |
{Duck, Duck, Goose}, |
| 17 |
duck soup, duck, duck and dive |
| 18 |
} |
| 19 |
\renewcommand{\DTLlistformatsep}{\newline} |
| 20 |
\renewcommand{\DTLlistformatlastsep}{\newline} |
| 21 |
\DTLsetup{compare={expand-cs=true}} |
| 22 |
\begin{document} |
| 23 |
\begin{multicols}{3} |
| 24 |
{\dtlsortlist{\mylist}{\dtlicompare} |
| 25 |
Case-insensitive:\newline |
| 26 |
\DTLformatlist{\mylist}.} |
| 27 |
|
| 28 |
{\dtlsortlist{\mylist}{\dtlwordindexcompare} |
| 29 |
Word sort:\newline |
| 30 |
\DTLformatlist{\mylist}.} |
| 31 |
|
| 32 |
\dtlsortlist{\mylist}{\dtlletterindexcompare} |
| 33 |
Letter sort:\newline |
| 34 |
\DTLformatlist{\mylist}. |
| 35 |
\end{multicols} |
| 36 |
\end{document} |