| 1 |
% This file is embedded in datatool-user.pdf version 3.4.3 2025-12-04 |
| 2 |
% Example 52 Formatting CSV Lists |
| 3 |
% Label: "ex:formatlist" |
| 4 |
% arara: pdflatex |
| 5 |
% arara: pdfcrop |
| 6 |
\documentclass[12pt]{article} |
| 7 |
\pagestyle{empty} |
| 8 |
\usepackage{datatool-base} |
| 9 |
\begin{document} |
| 10 |
\renewcommand{\DTLlistformatitem}[1]{\emph{#1}} |
| 11 |
One: \DTLformatlist{elephant}. |
| 12 |
|
| 13 |
Two: \DTLformatlist{elephant,ant}. |
| 14 |
|
| 15 |
Three: \DTLformatlist{elephant,ant,zebra}. |
| 16 |
|
| 17 |
Four: \DTLformatlist{elephant,ant,zebra,duck}. |
| 18 |
|
| 19 |
\renewcommand{\DTLlistformatoxford}{,} |
| 20 |
Oxford comma: \DTLformatlist{elephant,ant,zebra,duck}. |
| 21 |
|
| 22 |
Omit empty elements and leading/trailing spaces: |
| 23 |
\DTLformatlist{elephant , ant,,duck}. |
| 24 |
|
| 25 |
\DTLsetup{ |
| 26 |
lists = { trim = false, skip-empty = false } |
| 27 |
} |
| 28 |
Retain empty elements and leading/trailing spaces: |
| 29 |
\DTLformatlist{elephant , ant,,duck}. |
| 30 |
\end{document} |