| 1 |
% This file is embedded in datatool-user.pdf version 3.4.3 2025-12-04 |
| 2 |
% Example 102 Sorting CSV Data Using \DTLsortdata With Language Support |
| 3 |
% Label: "ex:sortlocale" |
| 4 |
% arara: pdflatex |
| 5 |
% arara: pdfcrop |
| 6 |
\documentclass[12pt]{article} |
| 7 |
\pagestyle{empty} |
| 8 |
\begin{filecontents}[noheader,overwrite]{customers.csv} |
| 9 |
Id,Organisation,Surname,Forename,Email,Age |
| 10 |
1,,Parrot,Polly,[email protected],42 |
| 11 |
2,University of Somewhere,Canary,Mabel,[email protected] |
| 12 |
3,University of Somewhere,Zebra,Zoë,[email protected],21 |
| 13 |
4,Zinnia Florestry,Arara,José,[email protected],42 |
| 14 |
5,,Duck,Dickie,[email protected], |
| 15 |
6,Newt Fellowship,Axolotl,Lizzie,[email protected] |
| 16 |
7,Avian Emporium,Canary,Fred,[email protected],19 |
| 17 |
8,Newt Fellowship,,Molgina,[email protected] |
| 18 |
9,,Mander,Sally |
| 19 |
10,Élite Emporium,Fant,Eli,[email protected],101 |
| 20 |
\end{filecontents} |
| 21 |
|
| 22 |
\usepackage[locales=en-GB]{datatool} |
| 23 |
\DTLsetup{store-datum,default-name=customers} |
| 24 |
\DTLread{customers.csv} |
| 25 |
\begin{document} |
| 26 |
% sort data by Organisation, then Surname, then Forename |
| 27 |
\DTLsortdata{customers}{Organisation,Surname,Forename} |
| 28 |
|
| 29 |
\DTLaction{display} |
| 30 |
\end{document} |