| 1 |
% This file is embedded in datatool-user.pdf version 3.4.3 2025-12-04 |
| 2 |
% Example 62 Sort Word Hook (Roman Numerals) |
| 3 |
% Label: "ex:sortwordhook" |
| 4 |
% arara: pdflatex |
| 5 |
% arara: pdfcrop |
| 6 |
\documentclass[12pt]{article} |
| 7 |
\pagestyle{empty} |
| 8 |
\usepackage{datatool-base} |
| 9 |
\newcommand{\mylist}{John XVI,John VI, John XIX, John IX, John IV,John VII, John V} |
| 10 |
\begin{document} |
| 11 |
\DTLsortwordlist{\mylist}{\DTLsortwordhandler} |
| 12 |
\DTLformatlist{\mylist}. |
| 13 |
|
| 14 |
\newcommand{\Ord}[1]{\MakeUppercase{\romannumeral #1}} |
| 15 |
\dtlSortWordCommands{\renewcommand\Ord[1]{\two@digits{#1}}} |
| 16 |
\renewcommand{\mylist}{John \Ord{16},John \Ord{6}, |
| 17 |
John \Ord{19}, John \Ord{9}, John \Ord{4},John \Ord{7}, |
| 18 |
John \Ord{5}} |
| 19 |
\DTLsortwordlist{\mylist}{\DTLsortwordhandler} |
| 20 |
\DTLformatlist{\mylist}. |
| 21 |
\end{document} |